5 unstable releases

0.3.0 Nov 22, 2023
0.2.0 Nov 5, 2019
0.1.2 Oct 19, 2019
0.1.1 Oct 19, 2019
0.1.0 Oct 19, 2019

#1100 in Algorithms

Download history 147/week @ 2024-07-27 19/week @ 2024-08-17 32/week @ 2024-08-24 1/week @ 2024-08-31 26/week @ 2024-09-07 23/week @ 2024-09-21 26/week @ 2024-09-28 13/week @ 2024-10-05 27/week @ 2024-10-12 5/week @ 2024-10-19 12/week @ 2024-10-26 58/week @ 2024-11-02

103 downloads per month
Used in mcmc

Custom license

35KB
493 lines

Crate Docs License Build Status

ARIMA

Rust crate for ARIMA model coefficient estimation and simulation.

Example

extern crate rand;
use rand::prelude::*;
use rand_distr::{Distribution, Normal};
use arima::{estimate, sim};

fn main() {
    // initialize RNG with seed
    let mut rng: StdRng = SeedableRng::from_seed([100; 32]);

    // our noise should be normally distributed
    let normal = Normal::new(10.0, 2.0).unwrap();

    // simulate time series
    let ts = sim::arima_sim(
        1000,                   // number of samples
        Some(&[0.7, 0.2]),      // AR parameters
        Some(&[0.4]),                   // MA parameters
        0,                      // difference parameter
        &|mut rng| { normal.sample(&mut rng) }, // noise fn
        &mut rng                // RNG
    ).unwrap();

    // estimate AR parameters
    let coef = estimate::fit(&ts, 2, 0, 1).unwrap();

    println!("Estimated parameters: {:?}", coef);
    // Estimated parameters: [14.904840907703845, 0.7524268545022731, 0.14075584488434256, 0.35966423499627603]
}

Features

  • Full ARIMA model parameter estimation
  • Auto-correlation/covariance calculation
  • Partial auto-correlation calculation
  • AR parameter estimation
  • Variance estimation
  • ARIMA time series simulation

Roadmap

  • Order estimation

License

This crate is licensed under the Apache-2.0 license.

Dependencies

~2–28MB
~362K SLoC