arch.univariate.ARCHInMean

class arch.univariate.ARCHInMean(y: ndarray | DataFrame | Series | None = None, x: ndarray | DataFrame | Series | ndarray[tuple[int, int], dtype[float64]] | None = None, lags: int | list[int] | ndarray[tuple[int, ...], dtype[int32]] | ndarray[tuple[int, ...], dtype[int64]] | None = None, constant: bool = True, hold_back: int | None = None, volatility: VolatilityProcess | None = None, distribution: Distribution | None = None, rescale: bool | None = None, form: float | 'log' | 'vol' | 'var' = 'vol')[source]

(G)ARCH-in-mean model and simulation.

Parameters:
y: ndarray | DataFrame | Series | None = None

Vector of nobs elements containing the dependent variable.

x: ndarray | DataFrame | Series | ndarray[tuple[int, int], dtype[float64]] | None = None

Array with nobs rows and k columns containing exogenous regressors. Must contain only finite values.

lags: int | list[int] | ndarray[tuple[int, ...], dtype[int32]] | ndarray[tuple[int, ...], dtype[int64]] | None = None

Description of lag structure of the AR. Scalar included all lags between 1 and the value. A 1-d array includes the AR lags lags[0], lags[1], … The lags must be integers (2.5, 5.0 and True are not accepted). A scalar must be at least 0, and the values of an array at least 1.

constant: bool = True

Flag whether the model should include a constant.

hold_back: int | None = None

Number of observations at the start of the sample to exclude when estimating model parameters. Used when comparing models with different lag lengths to estimate on the common sample. Must be a non-negative integer.

volatility: VolatilityProcess | None = None

Volatility process to use in the model. volatility.updateable must return True.

distribution: Distribution | None = None

Error distribution to use in the model.

rescale: bool | None = None

Flag indicating whether to automatically rescale data if the scale of the data is likely to produce convergence issues when estimating model parameters. If False, the model is estimated on the data without transformation. If True, then y is rescaled and the new scale is reported in the estimation results. If None, the data is not rescaled and a warning is issued when its scale is likely to produce convergence issues.

form: float | 'log' | 'vol' | 'var' = 'vol'

The form of the conditional variance that appears in the mean equation. The string names use the log of the conditional variance (“log”), the square-root of the conditional variance (“vol”) or the conditional variance. When specified using a float, interpreted as \(\sigma_t^{form}\) so that 1 is equivalent to “vol” and 2 is equivalent to “var”. When using a number, must be finite and different from 0. The strings are not case sensitive.

Raises:
  • TypeError – If lags or hold_back is not an integer (a float, including 5.0, and a bool are not accepted), if constant or rescale is not a bool (rescale can also be None), if volatility or distribution is not an instance of VolatilityProcess or Distribution, or if x cannot be converted to numbers, or if form is not a string or a number.

  • ValueError – If lags is negative, empty or in an unsupported format, if the largest lag is not smaller than the number of observations, if hold_back is negative, if form is a string other than “log”, “vol” or “var” or is not finite or is 0, or if x contains NaN or inf or does not have a row for each observation of y.

Notes

The (G)arch-in-mean model with exogenous regressors (-X) is described by

\[y_t = \mu + \kappa f(\sigma^2_t)+ \sum_{i=1}^p \phi_{L_{i}} y_{t-L_{i}} + \gamma' x_t + \epsilon_t\]

where \(f(\cdot)\) is the function specified by form.

Examples

>>> import numpy as np
>>> from arch.univariate import ARCHInMean, GARCH
>>> from arch.data.sp500 import load
>>> sp500 = load()
>>> rets = 100 * sp500["Adj Close"].pct_change().dropna()
>>> gim = ARCHInMean(rets, lags=[1, 2], volatility=GARCH())
>>> res = gim.fit(disp="off")

Methods

append(y[, x])

Append observations to the model in-place.

bounds()

Construct bounds for parameters to use in non-linear optimization.

compute_param_cov(params[, backcast, robust])

Compute parameter covariances using numerical derivatives.

constraints()

Construct linear constraint arrays for use in non-linear optimization.

fit([update_freq, disp, starting_values, ...])

Estimate model parameters.

fix(params[, first_obs, last_obs])

Construct an ARCHModelFixedResult from fixed parameters.

forecast(params[, horizon, start, align, ...])

Construct forecasts from estimated model.

parameter_names()

Return the names of the parameters of the mean model.

resids(params[, y, regressors])

Compute model residuals.

simulate(params, nobs[, burn, ...])

Simulate data from a linear regression, AR or HAR models.

starting_values()

Return starting values for the mean model.

Properties

distribution

Get or set the error distribution.

form

The form of the conditional variance in the mean.

name

The name of the model.

num_params

Number of parameters in the model.

volatility

Get or set the volatility process.

x

The exogenous regressors in the model.

y

The dependent variable.