data("lalonde")
# Matching based on race subsets
m.out_b <- matchit(treat ~ age + educ + married +
nodegree + re74 + re75,
data = subset(lalonde, race == "black"))
md_b <- match.data(m.out_b)
m.out_h <- matchit(treat ~ age + educ + married +
nodegree + re74 + re75,
data = subset(lalonde, race == "hispan"))
md_h <- match.data(m.out_h)
m.out_w <- matchit(treat ~ age + educ + married +
nodegree + re74 + re75,
data = subset(lalonde, race == "white"))
md_w <- match.data(m.out_w)
#Bind the datasets together
md_all <- rbind(md_b, md_h, md_w)
#Subclass conflicts are avoided
levels(md_all$subclass)
Run the code above in your browser using DataLab