ARMAGARCH#
- class cultivars.univariate.conditional_variance.ARMAGARCH(endog, *, ar_lags=1, ma_lags=1, p=1, q=1, mean='constant')[source]
Bases:
_ShortMemoryVarianceModel[ARMAGARCHResult]ARMA mean with a symmetric GARCH variance, estimated jointly.
The mean
\[y_t = c + \sum_{i=1}^{p} \phi_i\, y_{t-i} + \varepsilon_t + \sum_{j=1}^{q} \theta_j\, \varepsilon_{t-j}, \qquad \varepsilon_t = \sigma_t z_t,\]over the
GARCHvariance, with one likelihood for both. Whenma_lags > 0the mean residual feeds on its own past and the mean is searched through the partial autocorrelations, so the fit is stationary and invertible by construction; whenma_lags == 0the specification collapses toARGARCHand the lag weights are unconstrained. Both defaults are one, soARMAGARCH(y, ar_lags=2)keeps a moving-average term.- Variables:
_vol – The family name,
"GARCH"._p – ARCH order.
_o – Asymmetry order, always zero here.
_q – GARCH order.
_endog – The validated series.
_ar_lags – Conditional-mean AR order.
_ma_lags – Conditional-mean MA order.
_const – Whether the mean carries an intercept.
- Parameters:
- Raises:
SpecificationError – If an order is not a non-negative integer or
meanis not one of the two choices.DimensionError – If
endogis not one-dimensional or is shorter than the orders require.NumericalError – If
endogcontains non-finite values.
See also
ARMAGARCHResult– whatfit()returns.ARMAGJR,ARMAEGARCH– the same mean over the asymmetric variances.ARMAFIGARCH– the same mean over a long-memory variance.ARMA– the same mean with a constant variance and the exact likelihood.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> n = 2000 >>> s2 = np.ones(n) >>> e = np.zeros(n) >>> y = np.zeros(n) >>> for t in range(1, n): ... s2[t] = 0.05 + 0.10 * e[t - 1] ** 2 + 0.85 * s2[t - 1] ... e[t] = np.sqrt(s2[t]) * rng.standard_normal() ... y[t] = 0.5 * y[t - 1] + e[t] + 0.4 * e[t - 1] >>> res = ARMAGARCH(y, ar_lags=1, ma_lags=1).fit() >>> bool(res.is_stationary and res.is_invertible) True >>> bool(abs(res.ar_params[0] - 0.5) < 0.1), bool(abs(res.ma_params[0] - 0.4) < 0.1) (True, True) >>> res._comparison_label() 'ARMA(1, 1)-GARCH(1, 1)'