Skip to main content

Crate solow_statespace

Crate solow_statespace 

Source
Expand description

§solow-statespace

Linear-Gaussian state-space models and SARIMAX estimation.

The crate provides two layers:

  • kalman — a time-invariant StateSpace with an exact Kalman filter (returning the Gaussian log-likelihood and the filtered/predicted state sequences) and a fixed-interval smoother.
  • sarimax — a Sarimax seasonal ARIMA estimator built on the Kalman filter and fit by maximum likelihood. The AR/MA and seasonal polynomials are mapped into the Harvey companion-form state space, stationarity/invertibility are enforced by the Monahan reparametrization, and the model is optimized with BFGS over -loglike.
use ndarray::Array1;
use solow_statespace::{Sarimax, SarimaxOrder};

// A short AR(1)-like series.
let y = Array1::from_vec(vec![
    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,
]);
let model = Sarimax::new(y, SarimaxOrder::new(1, 0, 0)).unwrap();
let res = model.fit().unwrap();
assert_eq!(res.params.len(), 2); // [ar.L1, sigma2]

Re-exports§

pub use dynamic_factor::DynamicFactor;
pub use dynamic_factor::DynamicFactorResults;
pub use kalman::FilterOutput;
pub use kalman::StateSpace;
pub use mvkalman::MvStateSpace;
pub use sarimax::Sarimax;
pub use sarimax::SarimaxOrder;
pub use sarimax::SarimaxResults;
pub use structural::Level;
pub use structural::UcResults;
pub use structural::UcSpec;
pub use structural::UnobservedComponents;

Modules§

dynamic_factor
Dynamic-factor model with a single common factor, fit by maximum likelihood.
kalman
Linear-Gaussian Kalman filter and smoother.
mvkalman
Multivariate linear-Gaussian Kalman filter.
sarimax
SARIMAX(p, d, q)(P, D, Q, s) estimation by maximum likelihood.
structural
Unobserved-components (structural time-series) models, fit by maximum likelihood.