causalis.scenarios.unconfoundedness.refutation.score.residual_plots.plot_residual_diagnosticsplot_residual_diagnostics
Plot residual diagnostics for nuisance models.
Panels
Treated-only:
u1 = y - g1vsg1.Control-only:
u0 = y - g0vsg0.Binned calibration error:
E[d - m | m in bin]vs binnedm.
Notes
These plots check the nuisance pieces directly:
outcome residuals and should look roughly centered around zero without strong patterns against fitted values,
treatment residuals should average near zero within propensity bins.
Clear trends usually mean the nuisance models still leave structure in the data, which can show up later as unstable score diagnostics.
Parameters
- estimateCausalEstimate
Estimate with diagnostic data (
m_hat,g0_hat; optionallyg1_hat,y,d).- dataCausalData, optional
Optional fallback source for
yanddwhen missing in diagnostic data.- clip_propensityfloat, default 1e-6
Clipping epsilon for propensity values in the treatment-residual panel.
- n_binsint, default 20
Number of quantile bins for the binned-mean trend overlays.
- marker_sizefloat, default 12.0
Scatter marker size.
- alphafloat, default 0.35
Scatter opacity.
- max_scatter_pointsint, optional
Maximum number of points drawn in each residual scatter panel. When set, scatter points are sampled uniformly without replacement, while the binned-mean overlays and calibration panel still use all observations.
- random_stateint, optional
Random seed used when
max_scatter_pointstriggers scatter sampling.- figsizetuple, default (14.0, 4.8)
Figure size.
- dpiint, default 220
Dots per inch.
- font_scalefloat, default 1.10
Font scaling factor.
- savestr, optional
Path to save the figure.
- save_dpiint, optional
DPI for saving.
- transparentbool, default False
Whether to save with transparency.
Returns
The generated figure.
Examples
Canonical target
causalis.scenarios.unconfoundedness.refutation.score.residual_plots.plot_residual_diagnostics
Sections