Produces a paired sample out of a CEM match solution
pair(obj, data, method=NULL, mpower=2, verbose=1)
a list with the fields paired
, full.paired
,
reservoir
and reservoir2
. The latter contain the indexes
of the unmatched units.
an object as output from cem
the original data.frame used by cem
distance method to use in k2k
matching. See Details.
power of the Minkowski distance. See Details.
controls level of verbosity. Default=0.
Stefano Iacus, Gary King, and Giuseppe Porro
This function returns a vector of paired matched units index.
The user can choose a method
(between `euclidean
',
`maximum
', `manhattan
', `canberra
', `binary
'
and `minkowski
') for nearest neighbor matching inside each
cem
strata. By default method
is set to `NULL
',
which means random matching inside cem
strata. For the Minkowski
distance the power can be specified via the argument mpower
'.
For more information on method != NULL
, refer to
dist
help page.
Iacus, King, Porro (2011) tools:::Rd_expr_doi("10.1198/jasa.2011.tm09599")
Iacus, King, Porro (2012) tools:::Rd_expr_doi("10.1093/pan/mpr013")
Iacus, King, Porro (2019) tools:::Rd_expr_doi("10.1017/pan.2018.29")
# \donttest{
data(LL)
set.seed(123)
# cem match: automatic bin choice
mat <- cem(data=LL, drop="re78")
# we want a set of paired units
psample <- pair(mat, data=LL)
table(psample$paired)
psample$paired[1:100]
table(psample$full.paired)
psample$full.paired[1:10]
# cem match: automatic bin choice, we drop one row from the data set
mat1 <- cem(data=LL[-1,], drop="re78")
# we want a set of paired units but we have an odd number of units in the data
psample <- pair(mat1, data=LL[-1,])
table(psample$full.paired)
# }
Run the code above in your browser using DataLab