Skip to contents

Standardised mean differences, before and after weighting, plus the variance ratio per covariate.

Usage

morie_covariate_balance_check(X, treat, weights = NULL, threshold = 0.1)

Arguments

X

covariate matrix.

treat

0/1 treatment indicator.

weights

optional weights, e.g. from morie_causal_iptw_atoweights.

threshold

|SMD| above which a covariate counts as imbalanced.

Value

list with smd_before, smd_after, variance_ratio, n_imbalanced, balanced, worst (0-based).

Details

The SMD rather than a t-test, deliberately: a hypothesis test conflates imbalance with sample size, so a large study reports "significant imbalance" on differences too small to matter and a small one reports balance it has no power to reject. The SMD is a magnitude and does not move with n.

Balance on MEANS is necessary, not sufficient. Two distributions can share a mean and differ everywhere else, which is what variance_ratio is for – it should sit near 1.

References

Austin, P. C. and Stuart, E. A. (2015). Moving towards best practice when using inverse probability of treatment weighting. Statistics in Medicine, 34(28), 3661-3679.

Examples

set.seed(1)
X <- matrix(rnorm(200), ncol = 2)
morie_covariate_balance_check(X, rbinom(100, 1, 0.5))$balanced
#> [1] TRUE