[−][src]Function arima::sim::arima_sim
pub fn arima_sim<T: Rng>(
n: usize,
ar: Option<&[f64]>,
ma: Option<&[f64]>,
d: usize,
noise_fn: &dyn Fn(&mut T) -> f64,
rng: &mut T
) -> Result<Vec<f64>, ArimaError>
Simulate an ARIMA model time series
Arguments
n
- Length of the time seriesar
- 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::distributions::{Normal, Distribution}; let normal = Normal::new(0.0, 2.0); let x = arima::sim::arima_sim( 100, Some(&[0.9, -0.3, 0.2]), Some(&[0.4, 0.2]), 1, &|mut rng| { normal.sample(&mut rng) }, &mut thread_rng() ).unwrap();