了解matchit()中的“比率”参数

时间:2019-07-16 11:58:35

标签: r match matching

我无法理解matchit()函数中的“比率”参数。

根据文档,ratio = 1的参数method = "nearest"在比例为1:1的案例和控件上应该匹配。 但是,在这种情况下,它似乎只是镜像了原始变量的分布:

library(MatchIt)
data("lalonde")

attach(lalonde)
table(treat)                                  # 429 non treated, 185 treated
prop.table(table(treat))                      # 0.699 non treated, 0.301 treated
table(age, treat); t.test(age ~ treat)        # different
table(black, treat); chisq.test(black, treat) # different
detach(lalonde)

m_exact_test <- matchit(treat~age + black, data = lalonde, method = "exact", ratio = 1)

呼叫m_exact_test返回:

Call: 
matchit(formula = treat ~ age + black, data = lalonde, method = "exact", 
    ratio = 1)

Exact Subclasses: 34

Sample sizes:
          Control Treated
All           429     185
Matched       262     161
Unmatched     167      24

并且比率363∶161再次为0.619至0.381。 为了完整起见:在公式调用中切换blackage不会更改输出。

我确实从对Exact age matched match with Matchit doesn't work.的答复中意识到,控制/处理比率的倾斜是问题的一部分,但是我不明白为什么ratio参数不能解决问题。

而且,出于完整性考虑:为什么在matchit()函数matchit(treat ~ re74 + re75 + educ + black + hispan + age,data = lalonde, method = "nearest")的文档中的示例调用中没有出现此问题?

谢谢您的帮助。

1 个答案:

答案 0 :(得分:0)

x = 0, y = -1, z = 0 的{​​{1}}参数被忽略。如果您想要1:1的匹配(我不知道为什么会这么做,因为更精确的匹配总是更好,其他所有条件都一样),只需丢弃一些匹配的控制单元。另外,您还误读了输出:匹配的控件与处理的比例 262 为161,这与原始样本中的控件与处理的比例不同。

使用ratio时不会出现此问题,因为该方法不会忽略method = "exact"参数,如文档中所述。