GradedInterventionTimeSeries.plot_transforms#

GradedInterventionTimeSeries.plot_transforms(true_saturation=None, true_adstock=None, x_range=None, **kwargs)[source]#

Plot estimated saturation and adstock transformation curves.

Creates a 2-panel figure showing: 1. Saturation curve (input exposure -> saturated exposure) 2. Adstock weights over time (lag distribution)

Parameters:
  • true_saturation (SaturationTransform, optional) – True saturation transform for comparison (e.g., from simulation). If provided, will be overlaid as a dashed line.

  • true_adstock (AdstockTransform, optional) – True adstock transform for comparison (e.g., from simulation). If provided, will be overlaid as gray bars.

  • x_range (tuple of (min, max), optional) – Range for saturation curve x-axis. If None, uses data range.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (array of matplotlib.axes.Axes) – Array of 2 axes objects (left: saturation, right: adstock).

Return type:

Tuple[Figure, ndarray]

Examples

# Plot estimated transforms only
fig, ax = result.plot_transforms()

# Compare to true transforms (simulation study)
fig, ax = result.plot_transforms(
    true_saturation=HillSaturation(slope=2.0, kappa=50),
    true_adstock=GeometricAdstock(half_life=3.0, normalize=True),
)