在GenMatch中使用卡尺鼓励更多对 [英] Using calipers in GenMatch to enourage more pairs
问题描述
因此,请遵循Matching软件包中的示例,尤其是GenMatch示例
So following the example from the Matching package and in particular the GenMatch example
按照GenMatch
图书馆(匹配)
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)
我们看到185个治疗观察与270个非治疗观察配对. 现在,我们希望放宽此限制,以便根据年龄标准更灵活地配对.
We see 185 treated observation are paired with 270 non-treatment observation. Now we want to relax this to allow for more flexible pairing on the age criteria.
我们可以通过以下方式生成表格,其中奶头案例及其年龄在左侧,对照案例和年龄在以下范围内:
We can generate a table with the teatment cases and their age on the left and the control case and age on the right by:
pairs <- data.frame(mout$index.treated, lalonde$age[mout$index.treated], mout$index.control, lalonde$age[mout$index.control])
现在,使用Match()
的caliper
功能,我们应该能够生成更轻松的匹配.
Now using the caliper
function of the Match()
we should be able to generate a more relaxed match.
我们看到sd(lalonde$age)
为我们的表提供了7年的SD,因此请尝试匹配此限制.一个简单地
We see that sd(lalonde$age)
gives us a SD of 7 years for our table, so lets try and match for this limit. Would one 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)
它的出现并不是因为mout2
中出现的Matched number of observations
少于mout1
.
it appear not because less Matched number of observations
have occured in mout2
than mout1
.
那我哪里出问题了? 值必须包含在卡尺中,否则,如果它们为空,则返回错误
So where have I gone wrong? The values of zero must be included in caliper or else an error is returned if they are blank
推荐答案
您对GenMatch的首次调用没有施加 any 卡尺.您的第二个电话强加了卡尺,因此比赛次数将减少.如果您想增加首次通话的匹配次数,请参见"M"选项.您可能想要像一对一匹配之类的东西.
Your first call to GenMatch did not impose any caliper. Your second call imposed a caliper so the number of matches will decrease. If you want to increase the number of matches in your first call, see the "M" option. You probably want something like 1-to-2 matching, etc.
这篇关于在GenMatch中使用卡尺鼓励更多对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!