You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`summary(output="summary", digits=2)`|`str`| Tabular summary of causal effects. Set `output="report"` for narrative form. |
26
26
|`report()`|`str`| Narrative interpretation of results (shortcut for `summary(output="report")`) |
27
-
|`plot(metrics=None)`|`Figure`| Matplotlib figure with original/pointwise/cumulative panels. Pass a list like `["original", "cumulative"]` to select panels. Add `"decomposition"` for the DATE panel. |
28
-
|`decompose(alpha=None)`|`DateDecomposition`| DATE decomposition of pointwise effects into spot/persistent/trend. Call before plotting with `"decomposition"` metric. |
27
+
|`plot(metrics=None)`|`Figure`| Matplotlib figure with original/pointwise/cumulative panels. Pass a list like `["original", "cumulative"]` to select panels. |
29
28
|`run_placebo_test(n_placebos=None, min_pre_length=3)`|`PlaceboTestResults`| Validates the causal effect against a null distribution from pre-period splits. |
30
29
|`run_conformal_analysis(alpha=None)`|`ConformalResults`| Distribution-free prediction intervals via split conformal inference. |
31
30
@@ -64,19 +63,6 @@ ci = CausalImpact(data, pre_period, post_period, model_args=opts)
64
63
|`nseasons`|`int \| None`|`None`| Seasonal cycle count. `nseasons=1` is equivalent to no seasonal component. |
65
64
|`season_duration`|`int \| None`|`None`| Duration of each seasonal block; defaults to 1 when `nseasons` is set. Requires `nseasons` to be set. |
66
65
67
-
### Analysis Mode
68
-
69
-
`mode` controls forward vs retrospective analysis. Pass via `model_args` dict (not `ModelOptions`).
70
-
71
-
| Value | Description |
72
-
|---|---|
73
-
|`"forward"` (default) | Counterfactual prediction: fit on pre-period, predict post-period |
74
-
|`"retrospective"`| Treatment indicators as covariates: fit on entire series |
75
-
76
-
```python
77
-
ci = CausalImpact(data, pre, post, model_args={"mode": "retrospective"})
78
-
```
79
-
80
66
## `CausalImpactResults`
81
67
82
68
Returned by `ci._results`. A frozen dataclass containing all computed quantities.
- Forward mode (default): Use when you have a clear pre/post split and want counterfactual predictions. Standard CausalImpact workflow.
549
-
- Retrospective mode: Use when you want to decompose the treatment effect into spot/persistent/trend directly from the model, or when the treatment timing is known and you want a single-model-fit approach.
550
-
551
-
### Note on `prior_level_sd`
552
-
553
-
In retrospective mode, the local level state (random walk) and the persistent
554
-
treatment indicator (step function) are partially collinear. Setting
555
-
`prior_level_sd` to a small value (e.g., 0.001) constrains the state variation
556
-
and forces the model to attribute level shifts to the treatment columns.
557
-
558
-
---
559
-
560
440
## Summary of All Examples
561
441
562
-
All eight examples produce correct results:
442
+
All six examples produce correct results:
563
443
564
444
- When there is a true effect, the 95% credible interval contains the true value
565
445
- When there is no effect, the model correctly reports non-significance
566
446
- Results are consistent with the R CausalImpact package
567
-
- Retrospective mode extracts treatment components directly from beta posteriors
0 commit comments