API ReferenceEntry

confounders_balance

confounders_balance

Reference details for confounders_balance in causalis.shared.

confounders_balance

Functions
  • confounders_balance – Compute balance diagnostics for confounders between two treatment groups.
confounders_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
  • data (CausalData or MultiCausalData) – The causal dataset containing the dataframe and confounders.
  • treatment_d_0 (str) – For MultiCausalData, name of the first treatment column to compare. Mapped to output column mean_d_0.
  • treatment_d_1 (str) – For MultiCausalData, name of the second treatment column to compare. Mapped to output column mean_d_1.
Returns
  • DataFrame – Balance table sorted by |smd| (descending).