data("lalonde")
# MRI regression for ATT
lmw.out1 <- lmw(~ treat + age + education + race + married +
nodegree + re74 + re75, data = lalonde,
estimand = "ATT", method = "MRI",
treat = "treat")
lmw.fit1 <- lmw_est(lmw.out1, outcome = "re78")
lmw.fit1
summary(lmw.fit1)
if (FALSE) { # requireNamespace("MatchIt", quietly = TRUE)
# MRI regression for ATT after propensity score matching
m.out <- MatchIt::matchit(treat ~ age + education + race +
married + nodegree + re74 + re75,
data = lalonde, method = "nearest",
estimand = "ATT")
lmw.out2 <- lmw(~ treat + age + education + race + married +
nodegree + re74 + re75, data = lalonde,
method = "MRI", treat = "treat", obj = m.out)
## Using a cluster-robust SE with subclass (pair membership)
## as the cluster variable
lmw.fit2 <- lmw_est(lmw.out2, outcome = "re78", cluster = ~subclass)
lmw.fit2
summary(lmw.fit2)
}
# AIPW for ATE with MRI regression after propensity score
# weighting
ps <- glm(treat ~ age + education + race + married + nodegree +
re74 + re75, data = lalonde,
family = binomial)$fitted
ipw <- ifelse(lalonde$treat == 1, 1/ps, 1/(1-ps))
lmw.out3 <- lmw(re78 ~ treat + age + education + race + married +
nodegree + re74 + re75, data = lalonde,
method = "MRI", treat = "treat",
base.weights = ipw, dr.method = "AIPW")
lmw.fit3 <- lmw_est(lmw.out3)
lmw.fit3
summary(lmw.fit3)
# MRI for multi-category treatment ATE
lmw.out3 <- lmw(~ treat_multi + age + education + race + married +
nodegree + re74 + re75, data = lalonde,
estimand = "ATE", method = "MRI",
treat = "treat_multi")
lmw.fit3 <- lmw_est(lmw.out3, outcome = "re78")
lmw.fit3
summary(lmw.fit3)
Run the code above in your browser using DataLab