2017-03-19 18 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)