Skip to main content

solow_statespace/
lib.rs

1//! # solow-statespace
2//!
3//! Linear-Gaussian state-space models and SARIMAX estimation.
4//!
5//! The crate provides two layers:
6//!
7//! * [`kalman`] — a time-invariant [`StateSpace`] with an
8//!   exact Kalman [`filter`](kalman::StateSpace::filter) (returning the Gaussian
9//!   log-likelihood and the filtered/predicted state sequences) and a
10//!   fixed-interval [`smoother`](kalman::StateSpace::smooth).
11//! * [`sarimax`] — a [`Sarimax`] seasonal ARIMA estimator
12//!   built on the Kalman filter and fit by maximum likelihood. The AR/MA and
13//!   seasonal polynomials are mapped into the Harvey companion-form state space,
14//!   stationarity/invertibility are enforced by the Monahan reparametrization,
15//!   and the model is optimized with BFGS over `-loglike`.
16//!
17//! ```
18//! use ndarray::Array1;
19//! use solow_statespace::{Sarimax, SarimaxOrder};
20//!
21//! // A short AR(1)-like series.
22//! let y = Array1::from_vec(vec![
23//!     0.2, 0.5, 0.1, -0.3, 0.4, 0.8, 0.3, -0.1, 0.0, 0.6, 0.9, 0.2, -0.4, 0.1,
24//! ]);
25//! let model = Sarimax::new(y, SarimaxOrder::new(1, 0, 0)).unwrap();
26//! let res = model.fit().unwrap();
27//! assert_eq!(res.params.len(), 2); // [ar.L1, sigma2]
28//! ```
29
30pub mod dynamic_factor;
31pub mod kalman;
32pub mod mvkalman;
33pub mod sarimax;
34pub mod structural;
35
36pub use dynamic_factor::{DynamicFactor, DynamicFactorResults};
37pub use kalman::{FilterOutput, StateSpace};
38pub use mvkalman::MvStateSpace;
39pub use sarimax::{Sarimax, SarimaxOrder, SarimaxResults};
40pub use structural::{Level, UcResults, UcSpec, UnobservedComponents};