ARFIMA#

class cultivars.univariate.fractional_integration.ARFIMA(endog, *, order, trend='c', truncation=None)[source]

Bases: _FractionalIntegrationModel[ARFIMAResult]

Fractionally integrated ARMA specification.

The model \(\phi(L)(1 - L)^d (y_t - \mu) = \theta(L)\varepsilon_t\) with \(\mu\), \(d\), the short-memory block and \(\sigma^2\) estimated jointly. The filter is re-applied at every draw, because the differenced series is itself a function of \(d\); the search starts from a local Whittle estimate of \(d\) and is confined to \(|d| < 0.499\), so a series that wants integer differencing shows up with \(d\) at the boundary. The short-memory block is searched through the partial autocorrelations and so is stationary and invertible by construction. Mean reversion and the fractional order trade off against a near-unit autoregressive root – \(d = 0.3\) with no AR term and \(d = -0.5\) with \(\phi = 0.93\) fit a short sample about equally well – so keep order small unless the short-memory structure is known.

Variables:
  • _endog – The validated series.

  • _p – Short-memory AR order.

  • _q – Short-memory MA order.

  • _const – Whether a mean is estimated.

  • _truncation – Length of the fractional-difference filter.

Parameters:
  • endog (ArrayLike) – The series.

  • order (tuple[int, int]) – Short-memory (p, q).

  • trend (str) – "c" to estimate a mean, "n" to omit it.

  • truncation (int | None) – Fractional-filter length; defaults to the sample size.

Raises:
  • SpecificationError – If an order is negative, the trend is unrecognized, or truncation is not positive.

  • DimensionError – If endog is not one-dimensional or is shorter than 2(p + q) + 8.

  • NumericalError – If endog contains non-finite values.

See also

  • ARFIMAResult – what fit() returns.

  • ARIMA – integer differencing, the model for d at the boundary.

  • FIGARCH – the fractional filter on the variance.

References

Granger, C. W. J., & Joyeux, R. (1980). An introduction to long-memory time series models and fractional differencing. Journal of Time Series Analysis, 1(1), 15-29.

Hosking, J. R. M. (1981). Fractional differencing. Biometrika, 68(1), 165-176.

Example

Long memory preferred to a short-memory block on a fractionally integrated series:

>>> import numpy as np
>>> from cultivars.engine._core._transforms import _fractional_difference_weights
>>> rng = np.random.default_rng(0)
>>> n = 600
>>> w = _fractional_difference_weights(-0.3, n)
>>> y = np.convolve(rng.standard_normal(n + 300), w)[300 : 300 + n]
>>> pure = ARFIMA(y, order=(0, 0)).fit()
>>> with_ar = ARFIMA(y, order=(1, 0)).fit()
>>> bool(abs(with_ar.ar_params[0]) < 0.15), bool(abs(with_ar.d - pure.d) < 0.1)
(True, True)
>>> pure.compare(with_ar, criterion="bic").rows[0][0]
'ARFIMA(0, d, 0)'