
Covariate balance before and after weighting or matching
Source:R/otis_causal.R
morie_otis_balance.RdStandardised mean difference of every design column (factors expanded
to drop-first dummies) in the raw sample, under inverse-propensity
weights, and in the 1:1 nearest-neighbour matched sample (greedy, without
replacement, on the logit propensity with caliper
caliper_sd * SD(logit e); treated units in random order).
\(|SMD| > 0.1\) is the usual flag for meaningful imbalance (Austin 2011).
Usage
morie_otis_balance(
df,
treatment,
covariates,
outcome = NULL,
caliper_sd = 0.2,
eps = 0.02,
seed = 123L
)Arguments
- df
A data frame containing
treatment,outcome, and allcovariates(rows with NAs in these columns are dropped).- treatment
Name of the binary treatment column. Strings
"Yes"/"No"(case-insensitive) are auto-binarised; numeric columns are coerced with NA -> 0.- covariates
Character vector of covariate names. Character / factor columns are converted to drop-first dummies.
- outcome
Optional outcome column; rows missing it are dropped too.
- caliper_sd
Caliper in SDs of the logit propensity, or
NULLfor none (default 0.2).- eps
Numeric in \((0, 0.5)\); propensity clip bound (default 0.02).
- seed
Seed for the order treated units are matched in (default 123).
References
Austin, P. C. (2011). An introduction to propensity score methods for reducing the effects of confounding in observational studies. Multivariate Behavioral Research 46(3), 399-424.