# NOT RUN {
data("lalonde")
# Linearized probit regression PS:
m.out1 <- matchit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
distance = "glm", link = "linear.probit")
# }
# NOT RUN {
# GAM logistic PS with smoothing splines (s()):
m.out2 <- matchit(treat ~ s(age) + s(educ) + race + married +
nodegree + re74 + re75, data = lalonde,
distance = "gam")
summary(m.out2$model)
# }
# NOT RUN {
# CBPS for ATC matching w/replacement, using the just-
# identified version of CBPS (setting method = "exact"):
m.out3 <- matchit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
distance = "cbps", estimand = "ATC",
distance.options = list(method = "exact"),
replace = TRUE)
# }
# NOT RUN {
# Mahalanobis distance matching - no PS estimated
m.out4 <- matchit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
distance = "mahalanobis")
m.out4$distance #NULL
# Mahalanobis distance matching with PS estimated
# for use in a caliper; matching done on mahvars
m.out5 <- matchit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
distance = "glm", caliper = .1,
mahvars = ~ age + educ + race + married +
nodegree + re74 + re75)
summary(m.out5)
# User-supplied propensity scores
p.score <- fitted(glm(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
family = binomial))
m.out6 <- matchit(treat ~ age + educ + race + married +
nodegree + re74 + re75, data = lalonde,
distance = p.score)
# }
Run the code above in your browser using DataLab