# matching first
data(lalonde)
attach(lalonde)
fit <- glm(treat ~ re74 + re75 + age + factor(educ) +
black + hisp + married + nodegr + u74 + u75,
family=binomial(link="logit"))
pscores <- predict(fit, type="link")
matches <- matching(z=lalonde$treat, score=pscores)
matched <- lalonde[matches$matched,]
# make the plot
balanceplot(lalonde, matched, fit)
Run the code above in your browser using DataLab