placebo_in_time#

Placebo-in-time calibration and descriptive historical comparisons.

Explicit historical schedules can report average observed-minus-expected differences without calibration. The default retains hierarchical calibration of cumulative effects.

Builds a hierarchical Bayesian model of the “status quo” (no-effect) distribution from placebo folds, then compares the actual intervention effect against that learned null. Optionally computes Bayesian assurance (operating characteristics) against a user-supplied expected-effect prior.

Supports two fold-selection strategies:

  • sequential (default) — evenly-spaced sliding windows stepping backward from the actual treatment time.

  • random — randomly sampled eligible windows from the pre-intervention period, with constraints on minimum training fraction, minimum gap between folds, and optional period exclusion.

Supports experiments with a treatment_time parameter (InterruptedTimeSeries, SyntheticControl). Requires a Bayesian model backend (PyMC or pymc-forecast) for posterior extraction.

Explicit treatment_times can schedule historical windows independently of their length. With calibrate=False, report average historical differences and sampling diagnostics without fitting a null or issuing a causal verdict.

Classes

PlaceboFoldResult

Result of a single placebo fold.

PlaceboInTime

Historical placebo refits with optional hierarchical calibration.