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]

Bases: _SummaryMixin, _SeriesMixin, _ComparisonMixin

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

llf is a quasi-likelihood: comparable with other Whittle fits through compare() and likelihood_ratio_test(), not with a Kalman or particle likelihood of the same data. d and phi compete for the same persistence – with short_memory the AR(1) can absorb most of the memory and push d toward zero – and a small d against 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.0 when the law is pure fractional noise.

  • short_memory – Whether phi was 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

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.4 in 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

Private attributes#

_params

The parameter record, rebuilt for the emitter.

Private methods#

_comparison_label()

Specification label used when this result appears in a ranking.

_from_fit(fit, model)

Assemble the public result from a raw fit and its specification.

_series()

Aligned per-observation output.

_summary_table()

Structured summary rendered by every display path.