balanceplot {arm} | R Documentation |
This function plots the balance statistics before and after matching.
balanceplot(matched, pscore.fit, longcovnames = NULL, main = "Standardized Difference in Means", cex.main = 1, cex.vars = 0.8, cex.pts = 0.8, mar = c(0, 5, 4, 2), mgp = c(2, 0.25, 0), oma = c(0, 0, 0, 0), tcl = -0.2, ...)
matched |
matched data using matching function, see the example below. |
pscore.fit |
glm.fit object to get propensity scores. |
longcovnames |
long covariate names. If not provided, plot will use covariate variable name by default |
main |
title of the plot |
cex.main |
font size of main title |
cex.vars |
font size of variabel names |
cex.pts |
point size of the estimates |
mar |
margin of the plot, see ?par for details |
mgp |
axis margin of the plot, see ?par for details |
oma |
outer margin of the plot, see ?par for details |
tcl |
length of ticks, see ?par for details |
... |
other plot options may be passed to this function |
This function plots the balance statistics before and after matching. The open circle dots represent the unmatched balance statistics. The solid dots represent the matched balance statistics. The closer the value of the estimates to the zero, the better the treated and control groups are balanced after matching.
The function does not work with predictors that contain factor(x), log(x) or all other data transformation. Create new objects for these variables. Attach them into the original dataset before doing the matching procedure.
Jennifer Hill jh1030@columbia.edu; Yu-Sung Su ys463@columbia.edu
Andrew Gelman and Jennifer Hill, Data Analysis Using Regression and Multilevel/Hierarchical Models, Cambridge University Press, 2006. (Chater 10)
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,] balanceplot(matched, fit)