r - Using standard deviations in GenMatch to encourage more pairs -
so following example matching package , in particular genmatch example. this continues on previous question
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.
we can generate table treatment 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, literature weight.matrix
generated genmatch
cryptic , doesn't explain these values represent. have open question here. lets want relax matching more flexible pairing on age criteria occurs.
we see sd(lalonde$age)
gives sd of 7 years our data.
so want weight.matrix
account this. want use limit of 1 sd age
variable , return more pairs original 185-270.
my guess generate second genmatch
function continue code. use:
genout <- genmatch(tr=treat, x=x, balancematrix=balancemat, estimand="ate", pop.size=1000, max.generations=10, wait.generations=1, caliper=c(2,1,1,1,1,1,1,1,1,1))
but not increase number of pairs return.
any hints or solutions going wrong
as nick kennedy describes:
summary(as.logical(lalonde$treat)) mode false true na's logical 260 185 0
genmatch match m
times each treated case. can potentially drop treated cases, , drops control cases since many don't match, can't generate new treated cases out of thin air: multiple imputation ;-)
if mean, generating more matches per treated case achieved m
argument, caution needed, when number of controls close number of treated cases, in lalonde
data, since has found best match, , adding additional matches unlikely improve matters, , worsens them. best when number of controls >> number of treated.
you can reconstruct each 'pair' of matches when m > 1
output data, if like, , give number of rows greater 185 in treatment group, of course duplicates.
Comments
Post a Comment