r - Using calipers in GenMatch to enourage more pairs -
so following example matching package , in particular genmatch example
following example in genmatch
library(matching)
data(lalonde) attach(lalonde) x = cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74) balancemat <- cbind(age, educ, black, hisp, married, nodegr, u74, u75, re75, re74, i(re74*re75)) genout <- genmatch(tr=treat, x=x, balancematrix=balancemat, estimand="ate", m=1, pop.size=16, max.generations=10, wait.generations=1) genout$matches genout$ecaliper y=re78/1000 mout <- match(y=y, tr=treat, x=x, weight.matrix=genout) summary(mout)
we see 185 treated observation paired 270 non-treatment observation. want relax allow more flexible pairing on age criteria.
we can generate table teatment cases , age on left , control case , age on right by:
pairs <- data.frame(mout$index.treated, lalonde$age[mout$index.treated], mout$index.control, lalonde$age[mout$index.control])
now using caliper
function of match()
should able generate more relaxed match.
we see sd(lalonde$age)
gives sd of 7 years our table, lets try , match limit. 1 simply
mout2 <- match(y=y, tr=treat, x=x, weight.matrix=genout, caliper=c(1,0,0,0,0,0,0,0,0,0)) summary(mout2)
it appear not because less matched number of observations
have occured in mout2
mout1
.
so have gone wrong? values of 0 must included in caliper or else error returned if blank
your first call genmatch did not impose any caliper. second call imposed caliper number of matches decrease. if want increase number of matches in first call, see "m" option. want 1-to-2 matching, etc.
Comments
Post a Comment