IQSS / Zelig

A statistical framework that serves as a common interface to a large range of models
http://zeligproject.org
110 stars 43 forks source link

Estimate the ATT for each covariate in the data set. #345

Open Noorsaud opened 3 years ago

Noorsaud commented 3 years ago

I am working on estimating the ATT for a multiply imputed data set using Full Propensity scores Estimation. I got the total ATT, but cannot find the function to estimate the ATT for Sex (male, female), Language spoken (English, Spanish) to compare the performance for each group. The code is below:

Full Propensity scores Estimation

imp.data$ps <- imp.data$match.weight <- rep(0, nrow(imp.data)) for (i in unique(imp.data$.imp)) { in.imp <- imp.data$.imp == i imp.data$ps[in.imp] <- glm(Y ~ race + Ethnicity + Sex, data = imp.data[in.imp,], family="binomial")$fitted.values m.out <- matchit(Y ~ race + fedEthnicity + Sex, data = imp.data[in.imp,], method = "full", ratio = 1, replace = TRUE)

imp.data$match.weight[in.imp] <- m.out$weights

}

summary(m.out)

Define the multiply imputed data

m.data <- with(match.data(m.out), split(imp.data, imp.data$.imp)) View(m.data) mi.out <- to_zelig_mi(m.data$1, m.data$2, m.data$3, m.data$4, m.data$5, m.data$6, m.data$7, m.data$8, m.data$9, m.data$10, m.data$11, m.data$12, m.data$13, m.data$14, m.data$15, m.data$16, m.data$17, m.data$18, m.data$19, m.data$20, m.data$21, m.data$22, m.data$23, m.data$24, m.data$25, m.data$26, m.data$27, m.data$28, m.data$29, m.data$30, m.data$31, m.data$32, m.data$33, m.data$34, m.data$35, m.data$36, m.data$37, m.data$38, m.data$39, m.data$40, m.data$41, m.data$42, m.data$43, m.data$44, m.data$45, m.data$46, m.data$47, m.data$48, m.data$49, m.data$50, m.data$51, m.data$52, m.data$53, m.data$54, m.data$55, m.data$56, m.data$57, m.data$58, m.data$59, m.data$60, m.data$61, m.data$62, m.data$63, m.data$64, m.data$65, m.data$66, m.data$67, m.data$68, m.data$69, m.data$70, m.data$71, m.data$72, m.data$73, m.data$74, m.data$75, m.data$76, m.data$77, m.data$78, m.data$79, m.data$80, m.data$81, m.data$82, m.data$83, m.data$84, m.data$85, m.data$86, m.data$87, m.data$88, m.data$89, m.data$90, m.data$91, m.data$92, m.data$93, m.data$94, m.data$95, m.data$96, m.data$97, m.data$98, m.data$99, m.data$100)

ATT estimation

z.att0.mi <- zelig(SCORES~ Y, data = mi.out, model = "ls") ATT(z.att0.mi, treatment = "Y") qi0 <- get_qi(z.att0.mi, qi = "ATT", xvalue = "TE") combine_coef_se(z.att0.mi)

Appreciate your help!