VARMAResult#

class cultivars.multivariate.reduced_form.moving_average.VARMAResult(*, endog, names, order, trend, sigma_u, sigma_ml, resid, fittedvalues, design, llf, nobs, n_params, posterior=None, prior_label='none', coefficients, deterministic, ma_coefficients, long_order, refined)[source]#

A fitted vector autoregressive moving average.

The system

\[y_t = D d_t + \sum_{i=1}^{p} A_i\, y_{t-i} + u_t + \sum_{j=1}^{q} M_j\, u_{t-j}, \qquad u_t \sim (0, \Sigma_u),\]

estimated by the three Hannan-Rissanen passes: a long autoregression whose residuals stand in for the unobserved \(u_t\), a regression of \(y_t\) on its own lags and on lags of those residuals, and – when the second-stage moving-average block is invertible – a re-derivation of the innovations through the model and one more regression. The record holds the final pass, with the regressor matrix carrying lagged innovations in its trailing columns.

The propagation surface is inherited with one override that changes everything downstream: ma_representation() runs the VARMA recursion \(\Psi_h = M_h + \sum_i A_i \Psi_{h-i}\) rather than powering the autoregressive companion, and since the impulse responses, both variance decompositions, and the historical decomposition all read the moving-average matrices rather than the companion, correcting the one method corrects them all. forecast() is the other override, because a VARMA forecast carries the last q innovations across the sample boundary.

Note

Two things the inherited surface says that need reading with care. The standard errors treat the lagged innovations in the design as observed regressors; they are conditional in the Hannan-Rissanen sense and modestly understate uncertainty, and the summary says so. And an unrestricted VARMA is not globally identified – distinct \((A, M)\) pairs generate the same second moments, and the echelon-form restrictions that resolve this are not imposed – so the coefficient tables describe one representative of an equivalence class, while the moving-average matrices, forecasts, impulse responses and variance decompositions of a stable, invertible representative are invariant across it. Fitted to a non-invertible truth, the estimator returns the invertible representative with the same autocovariances, which is the right answer to the question least squares can ask.

Variables:
  • endog – The sample.

  • names – Variable labels, in Cholesky order.

  • order – Autoregressive order p.

  • ma_order – Moving-average order q.

  • long_order – Order of the stage-one autoregression that recovered the innovations.

  • refined – Whether the third pass ran. False means the second-stage moving-average block was not invertible, so re-deriving residuals through it would have amplified rather than reduced the approximation error, and the second-stage estimate was kept.

  • trend – Deterministic specification.

  • coefficients – (p, k, k) stack of A_1, ..., A_p.

  • ma_coefficients – (q, k, k) stack of M_1, ..., M_q.

  • deterministic – Deterministic coefficients, one row per term.

  • sigma_u – Residual covariance with the degrees-of-freedom correction.

  • sigma_ml – Residual covariance divided by the effective sample.

  • resid – One-step innovations over the effective sample.

  • fittedvalues – One-step conditional means over the effective sample.

  • design – The regressor matrix of the final pass.

  • llf – Gaussian log-likelihood of the final pass.

  • nobs – Effective sample size.

  • n_params – Free parameters, covariance included.

See also

  • VARMA – the model whose fit() returns this record.

  • VARResult – the q = 0 case, estimated in one pass with exact least squares.

  • ARMAResult – 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.

Dufour, J.-M., & Jouini, T. (2005). Asymptotic distribution of a simple linear estimator for VARMA models in echelon form. In Statistical Modeling and Analysis for Complex Data Problems (pp. 209-240). Springer.

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

Example

A bivariate VARMA(1, 1) with a diagonal-dominant autoregression and a moving-average block that spills from the first innovation into the second equation. The three passes recover both stacks, the long autoregression sits at the square root of the sample, the refinement ran, and the moving-average matrices start from the identity with \(\Psi_1 = A_1 + M_1\):

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> A = np.array([[0.5, 0.1], [0.0, 0.4]])
>>> M = np.array([[0.4, 0.0], [0.2, 0.3]])
>>> u = rng.standard_normal((402, 2))
>>> y = np.zeros((402, 2))
>>> for t in range(1, 402):
...     y[t] = A @ y[t - 1] + u[t] + M @ u[t - 1]
>>> res = VARMA(y[2:], order=(1, 1)).fit()
>>> bool(np.abs(res.coefficients[0] - A).max() < 0.15)
True
>>> bool(np.abs(res.ma_coefficients[0] - M).max() < 0.15)
True
>>> res.long_order, res.refined, res.is_stable, res.is_invertible
(20, True, True, True)
>>> psi = res.ma_representation(2)
>>> bool(np.allclose(psi[1], res.coefficients[0] + res.ma_coefficients[0]))
True
>>> res.forecast(3).shape, res.irf(4).shape
((3, 2), (5, 2, 2))

Attributes#

coefficients

The (p, k, k) autoregressive matrices of the final pass.

deterministic

The (d, k) deterministic coefficients, one row per term.

ma_coefficients

The (q, k, k) moving-average matrices of the final pass.

long_order

Order of the stage-one autoregression whose residuals proxied the innovations.

refined

Whether the third pass ran; False keeps the second-stage estimate.

bse

Standard errors, keyed identically to params.

coefficient_covariance

Covariance of the coefficient matrix, sampling or posterior.

companion

The (kp, kp) companion matrix of the autoregressive block.

design

endog

fittedvalues

information_criteria

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

is_invertible

Whether every moving-average root lies inside the unit circle.

is_stable

Whether every companion eigenvalue lies inside the unit circle.

k_endog

Number of endogenous variables.

llf

ma_order

Moving-average order q.

n_params

names

nobs

order

params

Every coefficient, keyed "{equation}: {regressor}".

posterior

prior_label

pvalues

Two-sided p-values against zero, keyed identically to params.

resid

sigma_ml

sigma_u

trend

tvalues

Normal test statistics against zero, keyed identically to params.

Methods#

arch_test(variable[, lags])

Engle's LM test for conditional heteroskedasticity in one equation.

compare(*others[, criterion])

Rank this result against others by an information criterion.

conf_int(*[, alpha])

Confidence bounds for every coefficient.

equation(name)

The coefficients of one equation, keyed by regressor.

fevd([horizon])

Forecast-error variance decomposition.

forecast([steps])

Deterministic multi-step forecasts from the end of the sample.

generalized_fevd([horizon])

Variance shares from the generalized responses, normalized to sum to one.

generalized_irf([horizon, cumulative])

Pesaran-Shin impulse responses, which do not depend on variable order.

granger_causality(cause, effect)

Wald test that one variable's lags are jointly zero in another equation.

historical_decomposition()

Attribute each observation to the shocks that produced it.

identify(strategy)

Declare an identification scheme and return the structural view.

invertibility_check()

Eigenvalue verdict for the moving-average companion matrix.

irf([horizon, orthogonalized, cumulative])

Impulse responses to a one-standard-deviation shock.

likelihood_ratio_test(unrestricted)

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

ma_representation([horizon])

Moving-average matrices Psi_0, ..., Psi_horizon of the VARMA.

normality_test(variable)

Jarque-Bera test on one equation's residuals.

portmanteau_test([lags])

Multivariate Ljung-Box test for residual autocorrelation.

residual_diagnostics(*[, portmanteau_lags, ...])

Run every residual test and collect them into one table.

simulate([n, seed, burn])

A fresh sample path from the fitted system.

stability_check()

Eigenvalue verdict for the companion matrix.

structural_shocks()

Orthogonalized innovations P^{-1} u_t, shape (nobs, k).

summary()

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