2017-03-19 8 views
0

私はRでMatch()ライブラリを使用していますが、ATTにはCIが必要です。Match()を使用して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:関連するコードが添付されています。バランスを見つけた後、私は回帰+ confint()メソッドで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)) 
``` 

答えて

0

あなたの問題はquantileに渡す引数だと思います。試してみよう:

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) 
関連する問題