if (FALSE) { # requireNamespace("MatchIt", quietly = TRUE)
library(MatchIt); data("lalonde", package = "cobalt")
## Nearest Neighbor matching
m.out1 <- matchit(treat ~ age + educ + race +
married + nodegree + re74 + re75,
data = lalonde, method = "nearest")
bal.tab(m.out1, un = TRUE, m.threshold = .1,
v.threshold = 2)
## Subclassification
m.out2 <- matchit(treat ~ age + educ + race +
married + nodegree + re74 + re75,
data = lalonde, method = "subclass")
bal.tab(m.out2, disp.subclass = TRUE)
}
Run the code above in your browser using DataLab