ehrapy.plot.causal_effect

Contents

ehrapy.plot.causal_effect#

ehrapy.plot.causal_effect(estimate, *, other=None, title=None, width=520, height=260)[source]#

Plot a single causal estimate, or a comparison across estimators, as a forest-style plot.

With just estimate the plot is a single point estimate plus 95% confidence interval (when available). With other supplied one row per estimator is drawn so methods can be compared side by side.

Parameters:
  • estimate (CausalEstimate) – The primary CausalEstimate to display.

  • other (dict[str, CausalEstimate] | None, default: None) – Optional mapping {label: estimate} of additional estimates to plot below the primary one.

  • title (str | None, default: None) – Plot title. If None, defaults to "Causal effect estimate".

  • width (int, default: 520) – Plot width in pixels.

  • height (int, default: 260) – Plot height in pixels.

Return type:

Overlay

Returns:

A holoviews.Overlay containing the point estimates, confidence-interval segments, and zero-line.

Examples

>>> import ehrapy as ep
>>> import ehrdata as ed
>>> edata = ed.dt.mimic_2_preprocessed()
>>> covs = ["age", "sofa_first", "sapsi_first"]
>>> est_iptw = ep.tl.iptw(edata, "aline_flg", "day_28_flg", covariates=covs, random_state=0)
>>> est_aipw = ep.tl.aipw(edata, "aline_flg", "day_28_flg", covariates=covs)
>>> ep.pl.causal_effect(est_aipw, other={"iptw": est_iptw})
Preview:
../../_images/causal_effect.png