causalis.scenarios.multi_unconfoundedness.refutation.unconfoundedness.love_plot

Love plots for baseline-versus-treatment covariate balance.

Module Contents

Functions

love_plot

Plot absolute SMDs before and after weighting, one panel per contrast.

Data

__all__

API

causalis.scenarios.multi_unconfoundedness.refutation.unconfoundedness.love_plot.love_plot(data: causalis.data_contracts.multicausaldata.MultiCausalData, estimate: causalis.data_contracts.multicausal_estimate.MultiCausalEstimate, *, threshold: float = 0.1, figsize: Optional[Tuple[float, float]] = None, dpi: int = 220, font_scale: float = 1.1, save: Optional[str] = None, save_dpi: Optional[int] = None, transparent: bool = False) → matplotlib.pyplot.Figure

Plot absolute SMDs before and after weighting, one panel per contrast.

Parameters

data : MultiCausalData Dataset used to fit the estimator; treatment index 0 is the baseline. estimate : MultiCausalEstimate ATE or ATTE estimate produced with diagnostic_data=True. threshold : float, default 0.10 Reference threshold for absolute standardized mean differences. figsize : tuple, optional Figure size in inches. Defaults to a grid of up to three columns with height scaled to the number of confounders and panel rows. dpi : int, default 220 Figure resolution. font_scale : float, default 1.10 Font scaling factor. save : str, optional Output path for saving the figure. save_dpi : int, optional Save resolution; defaults to 300 for raster formats, otherwise dpi. transparent : bool, default False Whether to save with a transparent background.

Returns

matplotlib.figure.Figure Figure closed in pyplot, but still available for display or saving.

Notes

Each panel compares one active treatment with the baseline using existing multi-treatment balance diagnostics. ATE uses inverse propensity weights; ATTE reweights the baseline to the corresponding treated population. Features share a stable ordering by their largest SMD across all panels, before or after weighting. Infinite values are clipped and annotated; NaN markers are omitted. Diagnostics are computed once, without refitting.

Examples

from causalis.scenarios.multi_unconfoundedness.refutation import love_plot estimate = model.fit().estimate(diagnostic_data=True) # doctest: +SKIP fig = love_plot(data, estimate, save=”balance.png”) # doctest: +SKIP

causalis.scenarios.multi_unconfoundedness.refutation.unconfoundedness.love_plot.__all__

[‘love_plot’]