我在 R 中使用 Match() 库,我需要 CI 用于 ATT。
有没有办法得到它?我想在计算 ATT 和 CI 时使用倾向得分。
怎么计算的?(即公式是什么,为什么?)
干杯,
PS:我看了那些,但这并不是我想要的: https ://stats.stackexchange.com/questions/132509/confidence-interval-for-average-treatment-effect-from-propensity-score -加权
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))
```