# NOT RUN {
data("lalonde", package = "cobalt")
#Nearest Neighbor Matching
library(MatchIt)
m.out <- matchit(treat ~ age + educ + race +
married + nodegree + re74 + re75,
data = lalonde)
bal.plot(m.out, "age", which = "both")
bal.plot(m.out, "re74", which = "both", type = "ecdf")
bal.plot(m.out, "race", which = "both")
bal.plot(m.out, "distance", which = "both", mirror = TRUE,
type = "histogram", colors = c("white", "black"))
# }
# NOT RUN {
#PS weighting with a continuous treatment
library(WeightIt)
w.out <- weightit(re75 ~ age + I(age^2) + educ +
race + married + nodegree,
data = lalonde)
bal.plot(w.out, "age", which = "both")
bal.plot(w.out, "married", which = "both")
# }
Run the code above in your browser using DataLab