【问题标题】:How to obtain confidence intervals for ATT using Match()如何使用 Match() 获得 ATT 的置信区间
【发布时间】:2017-03-19 17:09:18
【问题描述】:

我在 R 中使用 Match() 库,并且我需要 CI 用于 ATT。

  1. 有没有办法得到它?我想在计算 ATT 和 CI 时使用倾向得分。

  2. 如何计算? (即公式是什么,为什么?)

干杯,

PS:我看过这些,但并不是我想要的: https://stats.stackexchange.com/questions/132509/confidence-interval-for-average-treatment-effect-from-propensity-score-weighting

和:https://stats.stackexchange.com/questions/238431/is-the-average-treatment-effect-on-the-treated-att-a-meaningful-comparison-in

PS2:附上相关代码;找到平衡后,我尝试使用回归 + 限制()方法获得 CI,但它不起作用,因为我不知道如何传递倾向得分并且我强制进入回归模型(我确信这是不必要的,但我只知道 CI 的 confint 函数)。

(3) Using the Match() help file code example as a guide, use propensity score matching to produce an estimated treatment effect and confidence interval. Report your results.

```{r}
library(Matching)

DataFrame=as.data.frame(data1)

# Estimate the propensity model

glm1  <- glm(treat~age + I(age^2) + education + I(education^2) + black +
             hispanic + married + nodegree + re74  + I(re74^2) + re75 + I(re75^2) , family=binomial, data=DataFrame)
#save data objects
X  <- glm1$fitted
Y  <- DataFrame$re78
Tr  <- DataFrame$treat

# One-to-one matching with replacement (the "M=1" option).
# Estimating the treatment effect on the treated (the "estimand" option defaults to ATT==Average Treatment effect for Treated).
rr  <- Match(Y=Y, Tr=Tr, X=X, M=1);
summary(rr)
```
Finding Balance:

```{r}
# Let's check the covariate balance:
mb  <- MatchBalance(treat~age + I(age^2) + education + I(education^2) + black +hispanic + married + nodegree + re74  + I(re74^2) + re75 + I(re75^2), data=DataFrame, match.out=rr, nboots=500)

rr1  <- Match(Y=Y, Tr=Tr, X=X, M=1,Weight.matrix=);

#After obtaining balance, find ATT 
rr1  <- Match(Y=Y, Tr=Tr, X=X, M=1);
summary(rr1)
```

Find a way to obtain CIs - Doesnt work:
```{r}
X<-mb
Y<-re78
RegressionOnMatched<-lm(re78~X,data = )
confint(RegressionOnMatched)
#mean(rr$re78)
#quantile(rr$re78, c(0.025, 0.975))
```

【问题讨论】:

    标签: r statistics inference causality


    【解决方案1】:

    我相信你的问题是你传递给分位数的论点。试试这个:

    ci_upper <- 2*mean(rr$re78) - quantile(rr$re78, 0.025)    
    ci_lower <- 2*mean(rr$re78) - quantile(rr$re78, 0.975)
    ci <- c(ci_lower, ci_upper)
    

    【讨论】:

      猜你喜欢
      • 2021-06-13
      • 2014-07-14
      • 2017-01-18
      • 2019-12-26
      • 2014-05-08
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多