causalis.scenarios.iv.refutation.iv_confounders_balance¶
Module Contents¶
Functions¶
Compute confounder balance diagnostics between instrument groups. |
Data¶
API¶
- causalis.scenarios.iv.refutation.iv_confounders_balance.iv_confounders_balance(data: causalis.data_contracts.iv_causal_data.IVCausalData) pandas.DataFrame¶
Compute confounder balance diagnostics between instrument groups.
Produces a DataFrame containing expanded confounder columns (after one-hot encoding categorical variables if present) with:
confounders: name of the confounder
mean_z_0: mean value for rows with Z=0
mean_z_1: mean value for rows with Z=1
abs_diff: abs(mean_z_1 - mean_z_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 : IVCausalData The IV causal dataset containing exactly one binary instrument column.
Returns
pd.DataFrame Balance table sorted by |smd| (descending).
Examples
from causalis.scenarios.iv.refutation import iv_confounders_balance
Assuming ‘causal_data’ is an IVCausalData object
balance_df = iv_confounders_balance(causal_data) balance_df.head()
- causalis.scenarios.iv.refutation.iv_confounders_balance.__all__¶
[‘iv_confounders_balance’]