Module counterfactual

Source
Expand description

Counterfactual trajectory analysis.

Given a detected change point, extrapolates the pre-change trajectory beyond the change point and compares with the actual post-change trajectory. Answers: “What would have happened if the change hadn’t occurred?”

§References

  • Brodersen, K. H. et al. (2015). Causal impact. Annals of Applied Statistics.
  • Abadie, A. (2021). Synthetic controls. JEL, 59(2).

Structs§

CounterfactualResult
Counterfactual analysis result.

Enums§

CounterfactualMethod
Method used for counterfactual extrapolation.

Functions§

counterfactual_trajectory
Compute a counterfactual trajectory analysis.
fit_linear_per_dim 🔒
Fit a linear model y_d = slope_d * t + intercept_d for each dimension.
trapezoidal_integral 🔒
Trapezoidal rule integration of a (timestamp, value) curve.