balance  R Documentation 
This function computes the balance statistics before and after matching.
balance(rawdata, treat, matched, estimand="ATT") ## S3 method for class 'balance' print(x, ..., combined = FALSE, digits = 2) ## S3 method for class 'balance' plot(x, longcovnames=NULL, which.covs="mixed", v.axis=TRUE, cex.main=1, cex.vars=1, cex.pts=1, mar=c(4, 3, 5.1, 2), plot=TRUE, x.max = NULL, ...)
rawdata 
The full covariate dataset 
treat 
the vector of treatment assignments for the full dataset 
matched 
vector of weights to apply to the full dataset to create the restructured data: for matching without replacement these will all be 0's and 1's; for onetoone matching with replacement these will all be nonnegative integers; for IPTW or more complicated matching methods these could be any nonnegative numbers 
estimand 
can either be 
x 
an object return by the balance function. 
combined 
default is 
digits 
minimal number of significant digits, default is 2. 
longcovnames 
long covariate names. If not provided, plot will use covariate variable name by default 
which.covs 

v.axis 
default is 
cex.main 
font size of main title 
cex.vars 
font size of variabel names 
cex.pts 
point size of the estimates 
mar 
A numerical vector of the form 
plot 
default is 
x.max 
set the max of the 
... 
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 jennifer.hill@nyu.edu; YuSung Su suyusung@tsinghua.edu.cn
Andrew Gelman and Jennifer Hill. (2006). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press. (Chapter 10)
matching
,
par
# matching first old.par < par(no.readonly = TRUE) 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 < matches$cnts # balance check b.stats < balance(lalonde, treat, matched, estimand = "ATT") print(b.stats) plot(b.stats) par(old.par)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.