[][src]Function arima::acf::pacf

pub fn pacf<T: Float + From<u32> + From<f64> + Into<f64> + Copy + AddAssign>(
    x: &[T],
    max_lag: Option<usize>
) -> Result<Vec<T>, ArimaError>

Calculate the partial auto-correlation coefficients of a time series of length n. If you already calculated the auto-correlation coefficients (ACF), consider using pacf_rho instead.

Arguments

  • &x - Reference to input vector slice of length n.
  • max_lag - Maximum lag to calculate the PACF for. Defaults to n.

Returns

  • Output vector of length max_lag.

Example

use arima::acf;
let x = [1.0, 1.2, 1.4, 1.6];
let pr = acf::pacf(&x, Some(2)).unwrap();
assert!((pr[0] - 0.25).abs() < 1.0e-7);
assert!((pr[1] - -0.3866667).abs() < 1.0e-7);