[−][src]Function arima::acf::ar_dl_rho_cov
pub fn ar_dl_rho_cov<T: Float + From<u32> + From<f64> + Copy + Add + AddAssign + Div>(
rho: &[T],
cov0: T,
order: Option<usize>
) -> Result<(Vec<T>, T), ArimaError>
Calculate the auto-regressive coefficients of a time series of length n, given the auto-correlation coefficients rho and auto covariance at lag 0, cov0. This method uses the Durbin-Levinson algorithm to iteratively estimate the coefficients, and it also returns the standard error for the 1-step look-ahead prediction (i.e. the estimated variance).
Arguments
&rho
- Reference to auto-correlation coefficients rho.cov0
- Autocovariance at lag 0.order
- Order of the AR model.
Returns
- Tuple of an output vector containing the AR coefficients and an estimate for the variance.
Example
use arima::acf; let x = [1.0, 1.2, 1.4, 1.6]; let rho = acf::acf(&x, None, false).unwrap(); let cov0 = acf::acf(&x, Some(0), true).unwrap()[0]; let (ar, err) = acf::ar_dl_rho_cov(&rho, cov0, Some(2)).unwrap(); assert!((ar[0] - 0.3466667).abs() < 1.0e-7); assert!((ar[1] - -0.3866667).abs() < 1.0e-7);