Expand description
Robust scale and autocovariance estimation.
qn— the Q_n scale estimator of Rousseeuw & Croux (1993), computed by the O(n log n) algorithm of Croux & Rousseeuw (1992). Conventions (consistency constant and finite-sample corrections) follow R’srobustbase::Qn, so the two agree to full double precision; note the published papers print the constant as 2.2219, a digit transposition of the correct 1/(sqrt(2) Φ⁻¹(5/8)) = 2.21914… (Ma & Genton 2000 print 2.2191).robust_autocovariance— the Q_n-based autocovariance of Ma & Genton (2000, eq. 4):γ̂_Q(h) = ¼ [Q²_{n−h}(u+v) − Q²_{n−h}(u−v)]withu = (X_1..X_{n−h}),v = (X_{h+1}..X_n). Breakdown point 25 %, the maximum possible for an autocovariance estimator.shrink_to_psd— γ̂_Q is not guaranteed positive semi-definite; this applies the shrinking repair (Rousseeuw & Molenberghs 1993): scale the off-diagonal lags by the largest1−λthat makes the Toeplitz matrix PSD (checked by Cholesky, found by bisection). λ = 0 on clean data.
Functions§
- qn
- Q_n scale estimator with Gaussian consistency constant and the
finite-sample corrections used by
robustbase::Qn(Croux & Rousseeuw 1992, updated constants).Q_n = d_n · 2.21914 · {|x_i − x_j|; i<j}_(k)withk = C(h,2),h = ⌊n/2⌋+1. Returns 0 for n < 2. - robust_
autocorrelation - Ma & Genton’s (2000) robust autocorrelations for lags
0..=max_lag:ρ̂_Q(h) = [Q²(u+v) − Q²(u−v)] / [Q²(u+v) + Q²(u−v)], bounded in [−1, 1] by construction and independent of the consistency constant. Numerator and denominator share the same contaminated pairs, so the additive-outlier bias that affectsγ̂_Q(h)/γ̂_Q(0)largely cancels (this is whatcrate::Statistic::PacfRobustfeeds into Levinson). - robust_
autocovariance - 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)]withu = (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 throughshrink_to_psdbefore Levinson/Yule–Walker use. - shrink_
to_ psd - Shrinking repair for a possibly non-PSD autocovariance sequence
(Rousseeuw & Molenberghs 1993): return
r'withr'(0) = r(0)andr'(h) = (1−λ) r(h), λ the smallest value in [0, 1] (up to bisection tolerance) such that the Toeplitz matrix ofr'stays positive definite with a relative ridge margin of1e-3 · r(0)— the margin keeps estimated sequences away from the PD boundary, where Levinson would report spurious reflection coefficients near ±1. On a sequence that already satisfies the margin this returns the input unchanged (λ = 0).