运行 Matching::Match 命令后获取对照组均值

Obtaining control group mean after running Matching::Match command

在 运行 Match 执行倾向得分匹配后,我想确定控制均值,以便绘制对照组的均值和治疗组侧的均值 + 估计值-并排。

虽然我不知道如何从 Match 的输出中提取它。我的想法是我可以使用 index.control 值来识别对照组,然后从那里估计平均值和 SE,但到目前为止我对这种方法没有任何运气。

我欢迎任何想法!

这段代码再现了一个简单的 PSM:

library(carData)
library(tidyverse)
library(Matching)

matching_df <- Mroz %>% 
  mutate(wc = case_when(wc == "yes" ~ "TRUE", 
                        wc == "no" ~ "FALSE")) %>% 
  drop_na(k5, k618, age, wc, hc, lfp)

matching_df$wc <- as.logical(matching_df$wc)

ps1 <- glm(wc ~ k5 + k618 + age + hc, 
           family = binomial, data = matching_df)

pscore <- ps1$fitted.values
matching_df <- cbind(matching_df, pscore)

Y <- matching_df$lfp
Tr <- as.logical(matching_df$wc)
  
psm1 <- Matching::Match(
  Y = Y, 
  Tr = Tr, 
  X = pscore, 
  estimand = "ATT", 
  M = 1, 
  replace = TRUE, 
  caliper = 0.05, 
  version = "fast")

summary(psm1)

Estimate...  0.17479 
SE.........  0.044963 
T-stat.....  3.8873 
p.val......  0.00010135 

Original number of observations..............  753 
Original number of treated obs...............  212 
Matched number of observations...............  207 
Matched number of observations  (unweighted).  1074 

Caliper (SDs)........................................   0.05 
Number of obs dropped by 'exact' or 'caliper'  5 

这个问题的答案是 运行:

mean(as.numeric(Y)[psm1$index.control])

[1] 1.519553