Skip to contents

For each column of x the standardised mean difference is \((\bar\mu_t - \bar\mu_c) / \sqrt{(s_t^2 + s_c^2)/2}\), the difference in group means in units of the pooled within-group spread. The pooling is a plain average of the two variances rather than the sample-size-weighted one, so the denominator does not move when weighting changes the effective group sizes.

Usage

morie_covariate_balance(x, treat, weights = NULL, threshold = 0.1)

Arguments

x

Numeric matrix of covariates (n x p); a vector is one column.

treat

Binary treatment indicator, length n.

weights

Optional non-negative observation weights.

threshold

Imbalance cutoff for \(|SMD|\). Default 0.1.

Value

Named list with smd, max_smd, imbalanced, n_imbalanced, balanced, threshold, n_treated, n_control, method.

Details

No p-value is reported. Austin's argument is that a hypothesis test of balance confounds imbalance with sample size, so the convention is to compare \(|SMD|\) against a fixed threshold, 0.1 by default.

Mirrors morie.fn.causbalt on the Python side.

References

Austin PC (2009). Balance diagnostics for comparing the distribution of baseline covariates between treatment groups in propensity-score matched samples. Statistics in Medicine, 28(25), 3083-3107.

Examples

set.seed(1)
morie_covariate_balance(matrix(rnorm(300), 100, 3), rbinom(100, 1, 0.5))$max_smd
#> [1] 0.1468218