Skip to main content

robust_autocovariance

Function robust_autocovariance 

Source
pub fn robust_autocovariance(x: &[f64], max_lag: usize) -> Result<Vec<f64>>
Expand description

Ma & Genton (2000, eq. 4) Q_n-based autocovariances for lags 0..=max_lag: γ̂_Q(0) = Q²_n(x) and γ̂_Q(h) = ¼ [Q²_{n−h}(u+v) − Q²_{n−h}(u−v)] with u = (X_1..X_{n−h}), v = (X_{h+1}..X_n). Location-invariant and scale- equivariant; 25 % temporal breakdown point. Not guaranteed PSD — pass the result through shrink_to_psd before Levinson/Yule–Walker use.

Caveat observed in simulation: an outlier in x_t contaminates the pair vectors at every lag h ≥ 1 but only one entry at lag 0, so under additive outliers the ratio γ̂_Q(h)/γ̂_Q(0) is biased upward at every lag, which easily breaks positive definiteness. For autocorrelations prefer robust_autocorrelation, whose shared denominator cancels that bias.