Skip to contents

A design is "balanced on X" if every |SMD(X_i)| <= threshold.

Usage

mrm_check_balancing(data, treatment_col, covariates, threshold_pct = 10)

Arguments

data

data.frame.

treatment_col

Binary 0/1 treatment column.

covariates

Character vector of covariate columns.

threshold_pct

%SMD imbalance threshold (default 10).

Value

Named list with table, threshold_pct, n_imbalanced, overall_balanced, interpretation.

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."