Composite balance verdict using the Imbens-Rubin %SMD criterion
Source:R/mrm_diagnostics.R
mrm_check_balancing.RdA design is "balanced on X" if every |SMD(X_i)| <= threshold.
Examples
set.seed(2026)
n <- 200L
df <- data.frame(
D = rbinom(n, 1, 0.4),
age = rnorm(n, 50, 10),
bmi = rnorm(n, 27, 4)
)
df$age[df$D == 1] <- df$age[df$D == 1] + 3 # imbalance on age
bal <- mrm_check_balancing(df,
treatment_col = "D",
covariates = c("age", "bmi")
)
bal$overall_balanced
#> [1] FALSE
bal$interpretation
#> [1] "1/2 covariates exceed |SMD|>10%; design UNBALANCED on this covariate set."