0

I'm using the Match() library in R, and I need CI for ATT.

  1. Is there a way to get it? I want to use propensity scores while calculating ATT and CI.

  2. How it'd be calculated? (i.e. what would be the formula and why?)

Cheers,

PS: I looked on those, but it wasn't quite what I was looking for: https://stats.stackexchange.com/questions/132509/confidence-interval-for-average-treatment-effect-from-propensity-score-weighting

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

PS2: Relevant piece of code attached; after finding balance, I try to obtain CIs with the regression+confint() method but it doesn't work because I don't know how to pass propensity scores and I force into regression model (I'm sure it's unnecessary, but I know only the confint function for CIs).

(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))
```
Community
  • 1
  • 1
oba2311
  • 373
  • 4
  • 12

1 Answers1

0

I believe your issue is the argument you are passing to quantile. Try this:

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)
DBD
  • 86
  • 3