SARIMA#

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

Multiplicative seasonal ARIMA, without exogenous regressors.

The model

\[\phi(L)\,\Phi(L^s)\,(1 - L)^d (1 - L^s)^D\,(y_t - \mu_t) = \theta(L)\,\Theta(L^s)\,\varepsilon_t,\]

in which the seasonal polynomials act at multiples of the period and multiply the non-seasonal ones, so a first-order seasonal autoregression at \(s = 4\) beside a non-seasonal AR(1) puts coefficients at lags 1, 4 and 5 with the lag-5 term fixed at \(-\phi_1\Phi_1\). The seasonal block is mandatory here – a SARIMA without one is an ARIMA, and the name should not be able to claim a seasonal structure it does not carry – and exog is not accepted; SARIMAX is the form with both.

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

  • order (tuple[int, int, int]) – Non-seasonal (p, d, q).

  • seasonal_order (tuple[int, int, int, int]) – Seasonal (P, D, Q, s) with s at least 2 when any of P, D, Q is positive.

  • trend (str) – Deterministic specification.

Raises:
  • SpecificationError – If an order has the wrong length or a negative entry, or seasonal terms are given with a period below 2.

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

See also

  • SARIMAX – the same with exogenous regressors.

  • ARIMA – without the seasonal block.

  • seasonality – whether the series has the seasonal structure this imposes.

Example

A seasonal AR(1) over a non-seasonal AR(1) at quarterly period, recovered on a series simulated from the multiplied polynomial:

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> e = rng.standard_normal(400)
>>> y = np.zeros(400)
>>> for t in range(5, 400):
...     y[t] = 0.5 * y[t - 1] + 0.4 * y[t - 4] - 0.2 * y[t - 5] + e[t]
>>> res = SARIMA(y, order=(1, 0, 0), seasonal_order=(1, 0, 0, 4)).fit()
>>> list(res.params)
['const', 'ar.L1', 'ar.S.L4', 'sigma2']
>>> phi, seasonal_phi = res.ar_params[0], res.seasonal_ar_params[0]
>>> bool(abs(phi - 0.5) < 0.1), bool(abs(seasonal_phi - 0.4) < 0.1)
(True, True)
>>> res._stationarity_ar().shape, res.is_stationary
((5,), True)

Attributes#

endog

The validated endogenous series.

exog

The validated exogenous regressors, or None.

order

The non-seasonal order (p, d, q).

seasonal_order

The seasonal order (P, D, Q, s).

trend

The deterministic specification.

Methods#

fit()

Estimate by exact maximum likelihood.