sensitivity.SensitivityResult
Result of unmeasured confounding sensitivity analysis.
Usage
sensitivity.SensitivityResult(
outcome,
treatment,
observed_ate_draws,
gamma_values,
delta_values,
adjusted_ate_mean,
prob_sign_change
)Contains the observed ATE posterior draws and adjusted ATE values for a grid of hypothetical confounder strengths (γ, δ).
The confounding model assumes a latent U with:
- Effect γ on the treatment variable
- Effect δ on the outcome variable
- Confounding bias in the ATE = γ × δ
Parameters
outcome: str-
Outcome variable name.
treatment: str-
Treatment variable name.
observed_ate_draws: np.ndarray-
Posterior draws of the unadjusted ATE, shape
(n_draws,). gamma_values: np.ndarray-
1D grid of γ (confounder → treatment) values.
delta_values: np.ndarray-
1D grid of δ (confounder → outcome) values.
adjusted_ate_mean: np.ndarray-
Mean bias-adjusted ATE at each grid point, shape
(n_gamma, n_delta). prob_sign_change: np.ndarray-
Posterior probability that the ATE sign flips at each grid point, shape
(n_gamma, n_delta).
Attributes
| Name | Description |
|---|---|
| observed_ate | Posterior mean of the unadjusted ATE. |
| observed_ate_hdi | Highest density interval of the unadjusted ATE at the default probability mass. |
| tipping_point | The γ × δ product that reduces the posterior mean ATE to zero. |
observed_ate
Posterior mean of the unadjusted ATE.
observed_ate: float
observed_ate_hdi
Highest density interval of the unadjusted ATE at the default probability mass.
observed_ate_hdi: np.ndarray
tipping_point
The γ × δ product that reduces the posterior mean ATE to zero.
tipping_point: float
A confounder whose effects on treatment and outcome multiply to this value would exactly nullify the observed average treatment effect. The tipping point equals the observed mean ATE because adjusted ATE = observed ATE − γ × δ.
Methods
| Name | Description |
|---|---|
| plot() | Contour plot of adjusted ATE vs. confounder strength. |
plot()
Contour plot of adjusted ATE vs. confounder strength.
Usage
plot(ax=None, cmap="RdBu_r", n_levels=20)Shows how the estimated ATE changes as a function of the hypothetical confounder’s effect on treatment (γ) and outcome (δ). A black contour line marks the tipping boundary where the adjusted ATE crosses zero.
Parameters
ax: matplotlib.axes.Axes | None = None-
Axes to plot on. Creates a new figure if None.
cmap: str = "RdBu_r"-
Matplotlib colormap name (default
"RdBu_r"). n_levels: int = 20- Number of filled contour levels.
Returns
matplotlib.figure.Figure- The figure containing the contour plot.