cem (version 1.1.19)

pair: Produces a paired sample out of a CEM match solution

Description

Produces a paired sample out of a CEM match solution

Usage

pair(obj, data, method=NULL, mpower=2, verbose=0)

Arguments

obj

an object as output from cem

data

the original data.frame used by cem

method

distance method to use in k2k matching. See Details.

mpower

power of the Minkowski distance. See Details.

verbose

controls level of verbosity. Default=0.

Value

obj

a list with the fields paired, full.paired, reservoir and reservoir2. The latter contain the indexes of the unmatched units.

Details

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.

References

Stefano Iacus, Gary King, Giuseppe Porro, ``Matching for Casual Inference Without Balance Checking: Coarsened Exact Matching,'' http://gking.harvard.edu/files/abs/cem-abs.shtml

Examples

Run this code
# NOT RUN {
data(LL)

# 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