causalis.shared.confounders_balance.confounders_balanceconfounders_balance
Compute balance diagnostics for confounders between two treatment groups.
Produces a DataFrame containing expanded confounder columns (after one-hot encoding categorical variables if present) with:
confounders: name of the confounder
mean_d_0: mean value for control group (t=0)
mean_d_1: mean value for treated group (t=1)
abs_diff: abs(mean_d_1 - mean_d_0)
smd: standardized mean difference (Cohen’s d using pooled std)
ks_pvalue: p-value for the KS test (rounded to 5 decimal places, non-scientific)
Parameters
- dataCausalData or MultiCausalData
The causal dataset containing the dataframe and confounders.
- treatment_d_0str, optional
For MultiCausalData, name of the first treatment column to compare. Mapped to output column
mean_d_0.- treatment_d_1str, optional
For MultiCausalData, name of the second treatment column to compare. Mapped to output column
mean_d_1.
Returns
Balance table sorted by |smd| (descending).
Canonical target
causalis.shared.confounders_balance.confounders_balance
Sections