ARMA#

class cultivars.univariate.box_jenkins.ARMA(endog, *, order, trend='c')[source]

Bases: SARIMAX

Stationary ARMA(p, q): no differencing, no seasonal block, no regressors.

The model \(\phi(L)\,(y_t - \mu_t) = \theta(L)\,\varepsilon_t\) on the series as given. Stationarity and invertibility are enforced by the reparameterization, so a series with a unit root is fitted with an autoregressive root pushed against the boundary rather than beyond it; the stability record’s largest modulus is the tell, and ARIMA with d = 1 the remedy.

Parameters:
  • endog (ArrayLike) – The endogenous series.

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

  • trend (str) – Deterministic specification.

Raises:
  • SpecificationError – If order is not two non-negative integers or the trend is unrecognized.

  • DimensionError – If the series is too short for the specification.

See also

  • ARIMA – with differencing.

  • AR – the pure autoregression, with conditional least squares available and the recursion-intercept convention for its constant.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> e = rng.standard_normal(600)
>>> y = np.zeros(600)
>>> for t in range(1, 600):
...     y[t] = 0.7 * y[t - 1] + e[t] + 0.4 * e[t - 1]
>>> res = ARMA(y, order=(1, 1)).fit()
>>> res.is_stationary and res.is_invertible
True
>>> bool(abs(res.ar_params[0] - 0.7) < 0.1), bool(abs(res.ma_params[0] - 0.4) < 0.1)
(True, True)

On a random walk the enforced stationarity shows as a root at the boundary:

>>> walk = ARMA(np.cumsum(y), order=(1, 0)).fit()
>>> bool(walk.ar_params[0] > 0.99), walk.is_stationary
(True, True)