MatchIt:完全匹配 - 长向量错误

发布于 2025-01-20 12:58:16 字数 647 浏览 5 评论 0原文

我正在进行一项分析,以评估土地保护政策对包裹级别土地使用变化的影响。为了解决保护计划注册的非随机性质,我正在处理经过处理和未处理的包裹级数据之间的匹配分析。当我尝试使用Matchit软件包运行完整的匹配时,我会遇到此错误。

Error in cbind(treatmentids, controlids) : 
long vectors not supported yet: ../include/Rinlinedfuns.h:535

我使用的配置是:

m1.out <- matchit(formula = Y ~ X1 + X2 + ..... Xn, data = dataframe, 
                   method = "full", distance = 'glm', link = 'logit',
                   estimand = 'ATT', ratio = 1, pop.size = 16)

其中x1 .. xn是连续的协变量,y是二进制处理变量。该数据集包含121226行,其中51693是处理,其余为对照样品。

我正在Windows机器上使用Matchit(4.3.4)运行R(4.0.2)。遗传或最近的邻居匹配方法正在运行没有任何问题。感谢对此的任何帮助。

I am running an analysis to assess the land conservation policy impact on land use change at parcel level. To address the non-random nature of conservation program enrollment, I am running a matching analysis between treated and non-treated parcel level data. I am getting this error when I am trying to run a full matching using MatchIt package.

Error in cbind(treatmentids, controlids) : 
long vectors not supported yet: ../include/Rinlinedfuns.h:535

The configuration I am using is:

m1.out <- matchit(formula = Y ~ X1 + X2 + ..... Xn, data = dataframe, 
                   method = "full", distance = 'glm', link = 'logit',
                   estimand = 'ATT', ratio = 1, pop.size = 16)

Where X1 .. Xn are continuous covariates, Y is a binary treatment variable. The dataset contains 121226 rows out of which 51693 are treatment and the rest are control samples.

I am running R (4.0.2) with MatchIt(4.3.4) on a windows machine. Genetic or nearest neighbor matching methods are running without any issues. I appreciate any help on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪操控生活 2025-01-27 12:58:16

这是来自 optmatch 的错误。对于使用 method = "full" 调用 matchit() 函数的 optmatch::fullmatch() 来说,这个问题太大了,无法处理。这是因为 fullmatch() 对所有成对距离进行搜索,在本例中,成对距离的数量超过 25 亿。该问题可能根本无法实现完全匹配。对于同样的问题,请参阅此处

您可以尝试的一些方法是施加非常严格的卡尺,这会减少合格节点的数量,或者使用 exact 参数添加精确匹配约束,这会将问题分割成更小的块,这些块可能会更复杂。易于管理。您还可以尝试对大量子类使用子分类,这近似于完全匹配。

另请注意,ratiopop.size 参数对于完全匹配没有任何作用,因此您应该将它们从对 matchit() 的调用中排除。

This is an error from optmatch. The problem is too big for optmatch::fullmatch(), the function matchit() calls with method = "full", to handle. This is because fullmatch() does a search over all pairwise distances, which in this case is over 2.5 billion in number. The problem may simply be infeasible for full matching. See here for the same problem.

Some things you can try are to impose a very strict caliper, which reduces the number of eligible nodes, or add an exact matching constraint using the exact argument, which splits the problem into smaller chunks that may be more manageable. You can also try using subclassification with a large number of subclasses, which approximates full matching.

Also note that the ratio and pop.size arguments do nothing with full matching, so you should exclude them from your call to matchit().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文