Skip to main content

solow_regime/
lib.rs

1//! # solow-regime
2//!
3//! Markov-switching (regime-switching) time-series models, estimated by maximum
4//! likelihood via the Hamilton filter.
5//!
6//! Two models are provided:
7//!
8//! * [`MarkovRegression`] — a first-order `k`-regime switching regression. The
9//!   intercept (and optional exogenous regressors) and, optionally, the error
10//!   variance may switch across regimes.
11//! * [`MarkovAutoregression`] — a `k`-regime switching autoregression of a given
12//!   `order`. The mean, the autoregressive coefficients, and optionally the
13//!   variance may switch across regimes.
14//!
15//! Both maximise the Hamilton-filter log-likelihood. The transition
16//! probabilities are mapped through a logistic transform, the variances through
17//! a square map, and (for the autoregression) the AR coefficients through the
18//! Monahan partial-autocorrelation stationarity transform, so that the BFGS
19//! optimiser in [`solow_optimize`] runs unconstrained. Filtered and smoothed
20//! regime probabilities are exposed via the Hamilton filter and the Kim
21//! smoother respectively.
22//!
23//! The parameter layout follows the canonical reference implementation. For
24//! [`MarkovRegression`] it is
25//! `[ transition | mean/exog (per regime) | variance ]`, and for
26//! [`MarkovAutoregression`] it is
27//! `[ transition | mean (per regime) | variance | autoregressive (per regime) ]`
28//! (variance precedes the autoregressive block). For two regimes the transition
29//! block is `[p[0->0], p[1->0]]`, i.e. the probability of *staying* in regime 0
30//! and the probability of moving from regime 1 to regime 0.
31
32mod filter;
33mod markov_autoregression;
34mod markov_regression;
35mod switching;
36
37pub use markov_autoregression::MarkovAutoregression;
38pub use markov_regression::MarkovRegression;
39pub use switching::MarkovResults;