pyhctsa.operations.scaling.long_memory_d¶
- pyhctsa.operations.scaling.long_memory_d(y)¶
Memory parameter d from the lowest frequencies of the periodogram (local Whittle estimate).
A long-memory process has a spectral density that follows a power law at low frequencies, \(f(\lambda) \sim G \lambda^{-2d}\) as \(\lambda \to 0\), with memory parameter \(d\) [1] [2]. A short-memory process (white noise, any stationary ARMA process) has a spectrum that is flat at zero frequency, \(d = 0\); \(0 < d < 1/2\) is stationary long memory, with autocorrelations that decay as \(k^{2d-1}\) and are not summable; \(-1/2 < d < 0\) is anti-persistence; and \(d = 1\) is a random walk. Fractional Gaussian noise with Hurst exponent \(H\) has \(d = H - 1/2\), and ARFIMA(p, d, q) processes [3] [4] have memory parameter \(d\) whatever their ARMA part.
The local Whittle (Gaussian semiparametric) estimator, proposed by Künsch [5] and analyzed by Robinson [6], fits only the power law, and only over the \(m\) lowest Fourier frequencies \(\lambda_j = 2\pi j/N\), \(j = 1, \dots, m\), leaving the spectrum at higher frequencies (the short-range correlation) unmodeled:
The periodogram \(I_j = |\sum_t (x_t - \bar{x}) e^{-i \lambda_j t}|^2\) is computed at \(\lambda_1, \dots, \lambda_m\) (its normalization does not affect the estimate).
Maximizing the Whittle likelihood of \(G \lambda^{-2d}\) at those frequencies, with the level \(G\) concentrated out, is minimizing
\[R(d) = \log\Big(\frac{1}{m} \sum_{j=1}^m \lambda_j^{2d} I_j\Big) - \frac{2d}{m} \sum_{j=1}^m \log \lambda_j,\]which is convex in \(d\).
\(\hat{d}\) is the minimizer of \(R\) on \([-1, 2]\) (bounded Brent search).
The estimate is computed on two bands, fixed fractions of the sampling rate: the frequencies below 1/128 cycles per sample (
d; timescales longer than 128 samples, \(m = \lfloor N/128 \rfloor\)) and those below 1/32 cycles per sample (d_32, \(m = \lfloor N/32 \rfloor\)). Their difference,d_diff, is near 0 when one power law holds over both bands, and is positive when positive short-range correlation steepens the spectrum within the wider band (an AR(1) process with coefficient 0.8 adds about 0.08 tod_32and nothing measurable tod).The bands are fixed fractions of the sampling rate rather than the usual power of the length, \(m = N^a\) with \(a\) between 0.5 and 0.8 [7] [8]. A power rule makes the estimate consistent for \(d\), but the band then moves to lower frequencies as \(N\) grows, so on a short-memory process the bias from short-range correlation, and with it the feature’s expected value, drifts with the length (for an AR(1) process with coefficient 0.8 and \(m = N^{0.65}\), from +0.41 at N = 500 to +0.12 at N = 8000). A fixed band estimates one population quantity at every length, the average log-log slope of the spectrum over that band (equal to \(d\) when the band lies inside the low-frequency power law), and only its variance falls with \(N\). Long memory is a property of the lowest frequencies: in simulations of short-memory AR(1) and ARMA(1, 1) processes the bias of
dwas at most +0.03 and did not change with \(N\) from 2000 to 8000, whereas a band reaching 1/16 cycles per sample was biased by +0.2 (AR(1), coefficient 0.8) to +0.4 (ARMA(1, 1)).- Parameters:¶
- y : array-like¶
The input time series.
- Returns:¶
‘d’: the local Whittle estimate on the frequencies below 1/128 cycles per sample.
’d_32’: the local Whittle estimate on the frequencies below 1/32 cycles per sample.
’d_diff’:
d_32 - d.
An estimate is NaN when its band holds fewer than 8 Fourier frequencies (
dandd_difffor N < 1024,d_32for N < 256), when the periodogram is zero at one of them, or when the minimizer reaches a bound of the search interval \([-1, 2]\), which happens when no power law describes the band (a strong periodic component within it, for example). All are NaN for a constant series or one containing NaN or Inf.- Return type:¶
dict
Notes
The estimator is consistent for \(-1/2 < d < 1/2\), with \(\hat{d}\) asymptotically normal with variance \(1/(4m)\), the semiparametric efficiency bound [6]; normality with that variance extends to \(d < 3/4\), and consistency to \(d \le 1\) [9]. The standard error therefore depends only on the length (about \(1/(2\sqrt{m})\), 0.18 for
dat N = 1024 and 0.06 at N = 8192, and somewhat larger at small \(m\)), so it is not returned, nor is the z-score \(2\sqrt{m}\,\hat{d}\) or the linear transform \(H = d + 1/2\). The log-periodogram regression of Geweke and Porter-Hudak [7] (GPH) estimates the same quantity with asymptotic variance \(\pi^2/(24m)\), about 1.6 times larger (standard deviation about 1.28 times larger), and is not computed.Limitations:
For \(1 < d < 2\) the estimate converges to 1 [9], so a random walk, an integrated series and a trended series all give values near 1, and values between about 0.5 and 1.1 do not distinguish stationary persistence, a unit root and a trend.
The estimator is inconsistent for \(d < -1/2\): an over-differenced series (e.g. differenced white noise, \(d = -1\)) gives about -0.5 to -0.7, so values below about -0.5 mean only strong anti-persistence.
Like every semiparametric estimator of \(d\), it reads any low-frequency power as long memory: trends, level shifts and slow oscillations raise
d(and then usually maked_diffnegative). A strong oscillation just above a band pushes that band’s estimate down (a sinusoid of period 50 in noise givesd_32of about -0.66).dis noisy at the shortest lengths at which it is defined (standard deviation about 0.3 at N = 1024).
Relation to
fluctuation_analysis(): its exponentalphaestimates \(d + 1/2\) for a stationary series, and on ARFIMA processes the two agree closely (Spearman correlation 0.95 betweendand the DFAalpha). They differ where the models’ assumptions differ: under short memory at long lengths, wheredis less biased and its error keeps falling as \(1/\sqrt{N}\); on random walks and other integrated series, wheredis near 1 andalphais usually NaN; and on a power law confined to frequencies below a corner, whichdisolates and the fluctuation function, averaging over a broad range of frequencies at every window length, does not.References