LongMemorySVResult#
- class cultivars.multivariate.structural.stochastic_volatility.LongMemorySVResult(*, endog, mean_spec, mean, mu, d, sigma2, phi, short_memory, llf, nobs, n_params, n_frequencies, log_variance, log_variance_std)[source]#
A Whittle-estimated long-memory stochastic-volatility model.
The fitted law is
\[y_t = c + e^{h_t/2} \epsilon_t, \qquad h_t = \mu + v_t, \qquad (1 - \phi L)(1 - L)^d v_t = \eta_t,\]estimated on the linearization \(\log (y_t - c)^2 = \mu + \mathbb{E}\log\epsilon_t^2 + v_t + \xi_t\) by maximizing the Whittle criterion over the positive Fourier frequencies, where the spectrum of the log-squared data is the ARFIMA(1, d, 0) spectrum plus the \(\pi^2/2\) white-noise floor of \(\xi_t\). The record carries the estimate, the criterion, and the log-variance path from the spectral smoother with its one stationary error band.
Note
llfis a quasi-likelihood: comparable with other Whittle fits throughcompare()andlikelihood_ratio_test(), not with a Kalman or particle likelihood of the same data.dandphicompete for the same persistence – withshort_memorythe AR(1) can absorb most of the memory and pushdtoward zero – and a smalldagainst the measurement floor is weakly identified; the summary says both.- Variables:
endog – The observed series.
mean_spec –
"constant"or"zero".mean – The observation mean
c.mu – Level of the log variance.
d – Fractional differencing order of the log variance.
sigma2 – Innovation variance of the fractional noise.
phi – Short-memory AR(1) coefficient of the log variance;
0.0when the law is pure fractional noise.short_memory – Whether
phiwas estimated.llf – The Whittle criterion at the optimum, read as a log-likelihood: the frequency-domain quasi-likelihood of the linearized model. Comparable only with other Whittle fits.
nobs – Observations.
n_params – Free parameters.
n_frequencies – Fourier ordinates the criterion summed over.
log_variance – Smoothed log-variance path,
(n,), from the spectral smoother.log_variance_std – The smoother’s stationary root mean squared error, repeated
(n,)times.
See also
LongMemorySV– the model whosefit()returns this record.LinearGaussianSSM– the substratequasi_state_space()emits onto.
References
Breidt, F. J., Crato, N., & de Lima, P. (1998). The detection and estimation of long memory in stochastic volatility. Journal of Econometrics, 83(1-2), 325-348.
Harvey, A. C., Ruiz, E., & Shephard, N. (1994). Multivariate stochastic variance models. Review of Economic Studies, 61(2), 247-264.
Example
Fractional noise with
d = 0.4in the log variance. The Whittle fit recovers the order and the innovation variance, the smoothed path tracks the truth, and the implied autocorrelation decays hyperbolically:>>> import numpy as np >>> from cultivars.engine._core._transforms import _fractional_difference_weights >>> rng = np.random.default_rng(0) >>> n, burn = 1500, 2000 >>> eta = 0.5 * rng.standard_normal(n + burn) >>> weights = _fractional_difference_weights(-0.4, n + burn) >>> v = np.convolve(eta, weights)[burn : n + burn] >>> y = np.exp((-1.0 + v) / 2) * rng.standard_normal(n) >>> res = LongMemorySV(y, mean="zero").fit() >>> round(res.d, 2), round(res.sigma2, 2), res.phi, res.short_memory (0.39, 0.1, 0.0, False) >>> res.nobs, res.n_params, res.n_frequencies, res.at_boundary (1500, 2.0, 750, False) >>> bool(np.corrcoef(res.log_variance, -1.0 + v)[0, 1] > 0.4) True >>> acf = res.autocorrelation(200) >>> bool(abs(acf[200] / acf[100] - 2 ** (2 * res.d - 1)) < 0.1) True
Attributes#
The observed series, |
|
|
|
the sample mean, or |
|
Level of the log variance. |
|
Fractional differencing order, searched over |
|
Innovation variance of the fractional noise. |
|
Short-memory AR(1) coefficient of the log variance; |
|
Whether |
|
The Whittle quasi-likelihood at the optimum; comparable only with Whittle fits. |
|
Observations. |
|
|
|
Positive Fourier ordinates the criterion summed over, |
|
The |
|
The smoother's stationary root mean squared error, repeated |
|
Whether |
|
AIC, BIC, and HQIC derived from the likelihood and parameter count. |
|
Smoothed volatility |
|
Methods#
|
Implied autocorrelation of the log variance at lags |
|
Rank this result against others by an information criterion. |
|
Test this result as the restricted model against a nesting one. |
|
The linearized model as a truncated AR(inf) linear-Gaussian state space. |
|
The estimation summary, renderable as text, HTML, or a dataframe. |
|
The aligned per-observation outputs as plain numpy arrays. |
|
The aligned per-observation outputs as a |
The aligned per-observation outputs as a |
|
|
Smoother bands on the volatility at a Gaussian coverage level. |