pub fn arima_forecast<F: Fn(usize, &mut T) -> f64, T: Rng>(
ts: &[f64],
n: usize,
ar: Option<&[f64]>,
ma: Option<&[f64]>,
d: usize,
noise_fn: &F,
rng: &mut T,
) -> Result<Vec<f64>>Expand description
Forecast an ARIMA model time series
§Arguments
ts- Time series to forecast fromn- Length to forecastar- Model parameters for the AR partma- Model parameters for the MA partd- Model parameter for the differencesnoise_fn- Function that takes a `Rng’ as input and returns noiserng- Reference to a mutableRng.
§Returns
- Output vector of length n containing the time series data.
§Example
use rand::prelude::*;
use rand_distr::{Distribution, Normal};
let normal = Normal::new(0.0, 2.0).unwrap();
let ts = [0.632, 0.594, -2.750, -5.389, -5.645, -7.672, -12.595, -18.260, -24.147, -31.427];
let x = arima::sim::arima_forecast(
&ts,
100,
Some(&[0.9, -0.3, 0.2]),
Some(&[0.4, 0.2]),
1,
&|i, mut rng| { normal.sample(&mut rng) },
&mut thread_rng()
).unwrap();