VARMA#

class cultivars.multivariate.reduced_form.moving_average.VARMA(endog, *, order, trend='c', names=None)[source]

Bases: _VectorAutoRegressionModel[VARMAResult]

Vector autoregressive moving average, estimated by Hannan-Rissanen.

Three passes, each a least-squares solve. The first fits a long autoregression – order growing with the square root of the sample – whose residuals estimate the unobservable innovations. The second regresses the sample on its own lags and on lags of those estimated innovations, which is the VARMA equation with a generated regressor standing in for the truth. The third re-derives the innovations recursively from the second-stage parameters, so they are consistent with the model rather than with the long autoregression, and estimates once more. When the second-stage moving-average block is not invertible the recursion would diverge instead of converge, so the third pass is skipped and the result says so.

No numerical optimizer, no likelihood surface, no starting values: the estimator is deterministic and fast, at the cost of the (small, and documented) efficiency loss relative to exact maximum likelihood, and of standard errors that condition on the estimated innovations. Lag-order selection is refused, because \((p, q)\) pairs are not nested least-squares designs; fit the candidates and rank them through the comparison surface.

Variables:
  • _endog – The validated (nobs, k) panel.

  • _names – Variable labels.

  • _order – Autoregressive order p.

  • _trend – Deterministic terms.

  • _prior – The base slot for a shrinkage prior, unused by this family.

  • _ma_order – Moving-average order q.

See also

  • VARMAResult – the record fit() returns.

  • VAR – the q = 0 model, one pass instead of three.

  • ARMA – the scalar counterpart, estimated by exact maximum likelihood.

References

Hannan, E. J., & Rissanen, J. (1982). Recursive estimation of mixed autoregressive-moving average order. Biometrika, 69(1), 81-94.

Lütkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. Springer. Chapters 11-12.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> u = rng.standard_normal((202, 2))
>>> y = np.zeros((202, 2))
>>> for t in range(1, 202):
...     y[t] = 0.5 * y[t - 1] + u[t] + 0.4 * u[t - 1]
>>> res = VARMA(y[2:], order=(1, 1)).fit()
>>> res.forecast(3).shape
(3, 2)

Private attributes#

Private methods#

_burn_for(order)

Leading observations lost across all three passes.

_innovation_block(innovations, start)

Stack u_{t-1}, ..., u_{t-q} for rows start onward.

_long_order()

Order of the stage-one autoregression.

_max_supported_lags()

Largest autoregressive order the sample can identify.

_recursive_innovations(deterministic, ar, ma)

Innovations implied by a parameter draw, computed forward in time.

_stage_regression(innovations, start)

Regress the sample on its lags and on lagged innovations.

_unpack(moments)

Split a stage's coefficients into deterministic, AR, and MA blocks.