pyhctsa.operations.medical.pol_var_resid¶
-
pyhctsa.operations.medical.pol_var_resid(x, D=
3, ar_order=2)¶ Clustering of large and small innovations: POLVAR on AR residuals with a median threshold.
A variant of
pol_var()that codes the residualse_tof a least-squares AR(ar_order) fit (with intercept) as large (1) or small (0) against the median of|e_t|, and counts runs of D equal symbols. Coding residuals rather than increments, at a threshold that fixesq = P(1) = 1/2, removes the dependence ofpol_var()on the lag-1 autocorrelation and the increment distribution, so the statistic measures the clustering of large and small innovations (volatility clustering, conditional heteroscedasticity [4]). It is invariant to the location and scale ofx.With
s_t = 1{|e_t| >= median|e|}(t = 1, …, n = N -ar_order) split into maximal runs of equal symbols with lengthsL_1, L_2, ...,pol_var_resid = (1/n) * sum_j floor(L_j / D),the number of non-overlapping words of D equal symbols per symbol. For a linear process with iid innovations the symbols are close to iid Bernoulli(1/2) and the statistic is close to
1 / (2**D - 1); larger values mean that large and small innovations cluster in time. Static nonlinear transforms of a linear process also give clustered residual magnitudes.As in
pol_var(), words of D zeros and of D ones are both counted. The published POLVAR statistic [1] [2] [3] codes raw beat-to-beat differences against a fixed threshold in ms and counts only the word of D zeros.The statistic combines standard parts: the run counting of POLVAR, introduced for heart-rate variability [3] [1]; coding against the median, as in the runs test of Wald and Wolfowitz [5]; and reading volatility clustering from the magnitudes of model residuals, as in tests for ARCH effects [4]. In effect it is a runs test for the clustering of large innovations. No published statistic of this form is known.
References
- Parameters:¶
- Returns:¶
The number of non-overlapping words of D equal symbols per residual. NaN if there are fewer than
2 * Dresiduals, if the series is constant, or if the AR model fits it exactly (e.g. a pure sinusoid, which is an exact AR(2) process), when there are no innovations to code.- Return type:¶
float