【发布时间】:2017-10-28 10:01:22
【问题描述】:
我在 LaLonde 数据集上使用 MatchIt 包,并且丢弃参数会产生两种类型的错误。 (如果我不使用丢弃参数,则代码有效)。在这两种情况下,都不清楚如何解决问题......
第一个问题是当我尝试discard = "hull.control"
m.opt1 <- matchit(treat ~ inc.re74 + inc.re75 + education + nonwhite +
age + nodegree, data = cps_controls, method = "optimal", ratio=1,
discard="hull.control")
产生此错误消息....
Loading required namespace: WhatIf
Preprocessing data ...
Performing convex hull test ...
Error in mclapply(1:m, in_ch, mc.cores = mc.cores) :
'mc.cores' > 1 is not supported on Windows
第二个问题是当我尝试discard = "control"
Error in d[i, ] <- abs(d1[i] - d0) :
number of items to replace is not a multiple of replacement length
有没有办法解决这些问题?谢谢!!
【问题讨论】:
-
您使用的是“lalonde”数据还是“cps_controls”数据?对于后者,请添加我们可以重现您的问题的数据示例。
-
您好,我使用的是 cps_controls,但刚刚使用 MatchIt 包中可用的 lalonde 数据集再次尝试 -
-
我收到了上面第一个问题的相同错误和提到的第二个问题的新错误-这是我使用的代码-如果我不使用丢弃参数,它再次起作用:m。 opt
-
这是新的错误信息。谢谢! fullmatch.matrix 中的错误(d,min.controls = ratio,max.controls = ratio,:负 'omit.fraction' 不允许 'min.controls' >= 2 另外:警告消息:1:在 optmatch 中:: fullmatch(d, min.controls = ratio, max.controls = ratio, : 如果没有 'data' 参数,则不保证匹配的顺序与您的原始数据相同。2:在 fullmatch.matrix(d, min. controls = ratio, max.controls = ratio, : 找到负的 omit.fraction 值,目前不支持