VARMA.fit#

VARMA.fit()[source]#

Estimate the system by the three Hannan-Rissanen passes.

Pass one regresses the sample on long_order of its own lags and keeps the residuals as innovation proxies, zero before they exist. Pass two regresses the sample on p own lags and q lags of the proxies from the first row where both are complete. Pass three, when the second-stage moving-average block is invertible, rebuilds the innovations recursively from the second-stage parameters and re-estimates from row max(p, q) + p; otherwise the second-stage estimate is reported with refined=False.

Return type:

VARMAResult

Returns:

The fitted result. refined on the result records whether the third pass ran; it is skipped only when the second-stage moving-average block is not invertible.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> u = rng.standard_normal((302, 2))
>>> y = np.zeros((302, 2))
>>> for t in range(1, 302):
...     y[t] = 0.5 * y[t - 1] + u[t] + 0.4 * u[t - 1]
>>> res = VARMA(y[2:], order=(1, 1)).fit()
>>> res.long_order, res.refined, res.nobs, res.design.shape
(18, True, 298, (298, 5))
>>> ar, ma = res.coefficients[0].diagonal(), res.ma_coefficients[0].diagonal()
>>> bool(np.abs(ar - 0.5).max() < 0.1), bool(np.abs(ma - 0.4).max() < 0.1)
(True, True)