繁体   English   中英

如何获取摘要中的Pair Distance列(MatchIt)

[英]How to obtain Pair Distance column in summary (MatchIt)

我正在尝试比较不同的 CEM 匹配,不幸的是 MatchIt package 没有 L 统计量,因此我想比较可以通过摘要 function 获得的配对距离列

我怎样才能只打印那一列? (由于我在原始数据集中应用了多个试验并且变量很多我想避免复制和粘贴)

library(tidyverse)
library(MatchIt)

data(lalonde)

cem1 <- matchit(treat ~ age + re74 + re75, data = lalonde, 
                 method = "cem")

cem2 <- matchit(treat ~ age + re74 + re75, data = lalonde, 
               method = "cem",
               cutpoints= list(age = c(20.5, 25.5, 30.5,35.5,40.5))
               )

summary(cem1, un=TRUE)
summary(cem2, un=TRUE)

我得到的结果

Call:
matchit(formula = treat ~ age + re74 + re75, data = lalonde, 
    method = "cem", cutpoints = list(age = c(20.5, 25.5, 30.5, 
        35.5, 40.5)))

Summary of Balance for All Data:
     Means Treated Means Control Std. Mean Diff. Var. Ratio eCDF Mean eCDF Max
age        25.8162       28.0303         -0.3094     0.4400    0.0813   0.1577
re74     2095.5737     5619.2365         -0.7211     0.5181    0.2248   0.4470
re75     1532.0553     2466.4844         -0.2903     0.9563    0.1342   0.2876


Summary of Balance for Matched Data:
    Means Treated Means Control Std. Mean Diff. Var. Ratio eCDF Mean eCDF Max Std. Pair 
                                                                                   Dist.
age        25.6286       25.8312         -0.0283     0.6863    0.0222   0.0619     0.2364     
re74     1299.0813     1755.5500         -0.0934     1.1026    0.0672   0.3764     0.1321     
re75     1016.9323     1228.5970         -0.0657     1.0062    0.0471   0.1852     0.1617    

Percent Balance Improvement:
     Std. Mean Diff. Var. Ratio eCDF Mean eCDF Max
age             90.8       54.1      72.7     60.8
re74            87.0       85.1      70.1     15.8
re75            77.3       86.2      64.9     35.6

Sample Sizes:
              Control Treated
All            429.       185
Matched (ESS)  169.79     175
Matched        288.       175
Unmatched      141.        10
Discarded        0.         0

我想要一张或多或少像这样的桌子

       cem1          cem2
       Pair. Dist.   Pair. Dist. 
age    0.1616        0.2364
re74   0.1289        0.1321 
re75   0.1671        0.1617  

summary() output 只是一个列表。 您可以使用str()查看其详细信息。

要仅获取感兴趣的列,请使用以下命令:

cbind(
  summary(cem1)$sum.matched[,"Std. Pair Dist."],
  summary(cem2)$sum.matched[,"Std. Pair Dist."]
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM