ARMAResult#

class cultivars.univariate.box_jenkins.ARMAResult(*, endog, fittedvalues, resid, llf, nobs, n_params, order, seasonal_order, trend, k_exog, ar_params, ma_params, seasonal_ar_params, seasonal_ma_params, beta, sigma2)[source]#

A fitted (seasonal) ARIMA, optionally with exogenous regressors.

The estimates of the multiplicative seasonal model on the differenced series \(w_t = \Delta^d \Delta_s^D y_t\),

\[\phi(L)\,\Phi(L^s)\,\bigl(w_t - x_t'\beta\bigr) = \theta(L)\,\Theta(L^s)\,\varepsilon_t, \qquad \varepsilon_t \sim N(0, \sigma^2),\]

where \(x_t\) stacks the deterministic terms and the exogenous regressors, so that \(\beta\) shifts the observation and the ARMA structure describes what is left. One record serves ARMA, ARIMA, SARIMA and SARIMAX: the orders and the seasonal block are fields, and the polynomials a diagnostic reads are always the multiplied ones, \(\phi(L)\Phi(L^s)\) for stationarity and \(\theta(L)\Theta(L^s)\) for invertibility, because either factor alone can pass while their product has an explosive root. Composes five capabilities: rendering, frame interop, criterion-named comparison, and the stationarity and invertibility assessments.

Variables:
  • endog – The full observed series.

  • fittedvalues – One-step fitted values on the differenced modeling series.

  • resid – One-step residuals on the differenced modeling series.

  • llf – Maximized exact log-likelihood.

  • nobs – Observations after differencing.

  • n_params – Free parameter count, including the innovation variance.

  • order – Non-seasonal (p, d, q).

  • seasonal_order – Seasonal (P, D, Q, s).

  • trend – Deterministic specification.

  • k_exog – Number of exogenous regressors.

  • ar_params – Non-seasonal AR coefficients.

  • ma_params – Non-seasonal MA coefficients.

  • seasonal_ar_params – Seasonal AR coefficients.

  • seasonal_ma_params – Seasonal MA coefficients.

  • beta – Coefficients on the deterministic and exogenous block.

  • sigma2 – Innovation variance.

Note

beta is an observation intercept, not a term inside the autoregression: under trend="c" its first entry is the mean of the differenced series, \(E[w_t] = \beta_0\), where the const of ARResult is the recursion’s intercept with mean \(c / (1 - \sum\phi_i)\). The two agree only at \(\phi = 0\); compare them through the implied mean, not the coefficient. The fitted and residual paths live on the differenced scale and have nobs rows, d + sD fewer than endog. Standard errors are not yet reported by this estimator.

See also

References

Box, G. E. P., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time Series Analysis: Forecasting and Control, 5th ed. Wiley.

Durbin, J., & Koopman, S. J. (2012). Time Series Analysis by State Space Methods, 2nd ed., chapter 3. Oxford University Press.

Example

>>> rng = np.random.default_rng(0)
>>> e = rng.standard_normal(600)
>>> y = np.zeros(600)
>>> for t in range(1, 600):
...     y[t] = 0.6 * y[t - 1] + e[t] + 0.4 * e[t - 1]
>>> res = ARMA(y, order=(1, 1)).fit()
>>> res.order, res.seasonal_order, res.nobs, res.n_params
((1, 0, 1), (0, 0, 0, 0), 600, 4)
>>> list(res.params)
['const', 'ar.L1', 'ma.L1', 'sigma2']
>>> bool(abs(res.ar_params[0] - 0.6) < 0.1), bool(abs(res.ma_params[0] - 0.4) < 0.1)
(True, True)
>>> res.is_stationary, res.is_invertible
(True, True)

A seasonal fit is judged on the multiplied polynomial, whose length is \(p + sP\):

>>> s = np.zeros(600)
>>> for t in range(13, 600):
...     s[t] = 0.5 * s[t - 1] + 0.4 * s[t - 12] - 0.2 * s[t - 13] + e[t]
>>> seasonal = SARIMA(s, order=(1, 0, 0), seasonal_order=(1, 0, 0, 12)).fit()
>>> list(seasonal.params), seasonal._stationarity_ar().shape
(['const', 'ar.L1', 'ar.S.L12', 'sigma2'], (13,))

Attributes#

endog

The full observed series, on the level scale.

fittedvalues

(nobs,) one-step fitted values on the differenced scale.

resid

(nobs,) one-step residuals on the differenced scale.

llf

Maximized exact log-likelihood.

nobs

Observations after differencing.

n_params

Free parameter count, including the innovation variance.

order

Non-seasonal (p, d, q).

seasonal_order

Seasonal (P, D, Q, s); all zero without a seasonal block.

trend

"n", "c" or "ct".

k_exog

Number of exogenous regressors.

ar_params

(p,) non-seasonal AR coefficients.

ma_params

(q,) non-seasonal MA coefficients.

seasonal_ar_params

(P,) seasonal AR coefficients.

seasonal_ma_params

(Q,) seasonal MA coefficients.

beta

Coefficients on the deterministic terms then the exogenous regressors.

sigma2

Innovation variance.

information_criteria

AIC, BIC, and HQIC derived from the likelihood and parameter count.

invertibility

Full eigenvalue verdict for the moving-average polynomial.

is_invertible

Whether every companion eigenvalue of the MA block is inside the unit circle.

is_stationary

Whether every companion eigenvalue lies inside the unit circle.

params

Estimated parameters keyed by display name, in table order.

seasonal_period

The seasonal period s; 0 when no seasonal block is present.

stability

Full eigenvalue verdict for the autoregressive polynomial.

Methods#

compare(*others[, criterion])

Rank this result against others by an information criterion.

likelihood_ratio_test(unrestricted)

Test this result as the restricted model against a nesting one.

simulate([n, seed, burn])

A fresh sample path at the fitted parameters.

summary()

The estimation summary, renderable as text, HTML, or a dataframe.

to_dict()

The aligned per-observation outputs as plain numpy arrays.

to_pandas(*[, index])

The aligned per-observation outputs as a pandas.DataFrame.

to_polars()

The aligned per-observation outputs as a polars.DataFrame.