Learn R Programming

cem (version 1.1.31)

k2k: Reduction to k2k Matching

Description

Reduces a CEM output to a k2k matching

Usage

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

Value

obj

an object of class cem.match

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.

Author

Stefano Iacus, Gary King, and Giuseppe Porro

Details

This function transforms a typical cem matching solution to a k-to-k match, with k variable along strata: i.e., in each stratum generated by cem, the match is reduce to have the same number of treated and control units. (This option will delete some data that matched well, and thus likely increase the variance, but it means that subsequent analyses do not require weights.)

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.

After k2k the weights of each matched observation are set to unity. Please notice that option keep.all=TRUE must be used in cem calls otherwise k2k will not work.

References

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")

Examples

Run this code
data(LL)
set.seed(123)
# cem match: automatic bin choice
mat <- cem(treatment="treated", data=LL, drop="re78", keep.all=TRUE)
mat
mat$k2k

# ATT estimate
att(mat, re78 ~ treated, data=LL)


# transform the match into k2k
mat2 <- k2k(mat, LL, "euclidean", 1)
mat2
mat2$k2k

# ATT estimate after k2k
att(mat2, re78 ~ treated, data=LL)

Run the code above in your browser using DataLab