Volatility Processes

A volatility process is added to a mean model to capture time-varying volatility.

Constant Variance

class arch.univariate.ConstantVariance[source]

Constant volatility process

Notes

Model has the same variance in all periods

backcast(resids)[source]

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

GARCH

class arch.univariate.GARCH(p=1, o=0, q=1, power=2.0)[source]

GARCH and related model estimation

The following models can be specified using GARCH:
  • ARCH(p)
  • GARCH(p,q)
  • GJR-GARCH(p,o,q)
  • AVARCH(p)
  • AVGARCH(p,q)
  • TARCH(p,o,q)
  • Models with arbitrary, pre-specified powers
Parameters:
  • p (int) – Order of the symmetric innovation
  • o (int) – Order of the asymmetric innovation
  • q (int) – Order of the lagged (transformed) conditional variance
  • power (float, optional) – Power to use with the innovations, abs(e) ** power. Default is 2.0, which produces ARCH and related models. Using 1.0 produces AVARCH and related models. Other powers can be specified, although these should be strictly positive, and usually larger than 0.25.
num_params

The number of parameters in the model

Type:int

Examples

>>> from arch.univariate import GARCH

Standard GARCH(1,1)

>>> garch = GARCH(p=1, q=1)

Asymmetric GJR-GARCH process

>>> gjr = GARCH(p=1, o=1, q=1)

Asymmetric TARCH process

>>> tarch = GARCH(p=1, o=1, q=1, power=1.0)

Notes

In this class of processes, the variance dynamics are

\[\sigma_{t}^{\lambda}=\omega + \sum_{i=1}^{p}\alpha_{i}\left|\epsilon_{t-i}\right|^{\lambda} +\sum_{j=1}^{o}\gamma_{j}\left|\epsilon_{t-j}\right|^{\lambda} I\left[\epsilon_{t-j}<0\right]+\sum_{k=1}^{q}\beta_{k}\sigma_{t-k}^{\lambda}\]
backcast(resids)[source]

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

Fractionally Integrated (FI) GARCH

class arch.univariate.FIGARCH(p=1, q=1, power=2.0, truncation=1000)[source]

FIGARCH model

Parameters:
  • p ({0, 1}) – Order of the symmetric innovation
  • q ({0, 1}) – Order of the lagged (transformed) conditional variance
  • power (float, optional) – Power to use with the innovations, abs(e) ** power. Default is 2.0, which produces FIGARCH and related models. Using 1.0 produces FIAVARCH and related models. Other powers can be specified, although these should be strictly positive, and usually larger than 0.25.
  • truncation (int, optional) – Truncation point to use in ARCH(\(\infty\)) representation. Default is 1000.
num_params

The number of parameters in the model

Type:int

Examples

>>> from arch.univariate import FIGARCH

Standard FIGARCH

>>> figarch = FIGARCH()

FIARCH

>>> fiarch = FIGARCH(p=0)

FIAVGARCH process

>>> fiavarch = FIGARCH(power=1.0)

Notes

In this class of processes, the variance dynamics are

\[h_t = \omega + [1-\beta L - \phi L (1-L)^d] \epsilon_t^2 + \beta h_{t-1}\]

where L is the lag operator and d is the fractional differencing parameter. The model is estimated using the ARCH(\(\infty\)) representation,

\[h_t = (1-\beta)^{-1} \omega + \sum_{i=1}^\infty \lambda_i \epsilon_{t-i}^2\]

The weights are constructed using

\[\begin{split}\delta_1 = d \\ \lambda_1 = d - \beta + \phi\end{split}\]

and the recursive equations

\[\begin{split}\delta_j = \frac{j - 1 - d}{j} \delta_{j-1} \\ \lambda_j = \beta \lambda_{j-1} + \delta_j - \phi \delta_{j-1}.\end{split}\]

When power is not 2, the ARCH(\(\infty\)) representation is still used where \(\epsilon_t^2\) is replaced by \(|\epsilon_t|^p\) and p is the power.

backcast(resids)[source]

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

EGARCH

class arch.univariate.EGARCH(p=1, o=0, q=1)[source]

EGARCH model estimation

Parameters:
  • p (int) – Order of the symmetric innovation
  • o (int) – Order of the asymmetric innovation
  • q (int) – Order of the lagged (transformed) conditional variance
num_params

The number of parameters in the model

Type:int

Examples

>>> from arch.univariate import EGARCH

Symmetric EGARCH(1,1)

>>> egarch = EGARCH(p=1, q=1)

Standard EGARCH process

>>> egarch = EGARCH(p=1, o=1, q=1)

Exponential ARCH process

>>> earch = EGARCH(p=5)

Notes

In this class of processes, the variance dynamics are

\[\ln\sigma_{t}^{2}=\omega +\sum_{i=1}^{p}\alpha_{i} \left(\left|e_{t-i}\right|-\sqrt{2/\pi}\right) +\sum_{j=1}^{o}\gamma_{j} e_{t-j} +\sum_{k=1}^{q}\beta_{k}\ln\sigma_{t-k}^{2}\]

where \(e_{t}=\epsilon_{t}/\sigma_{t}\).

backcast(resids)[source]

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

HARCH

class arch.univariate.HARCH(lags=1)[source]

Heterogeneous ARCH process

Parameters:lags ({list, array, int}) – List of lags to include in the model, or if scalar, includes all lags up the value
num_params

The number of parameters in the model

Type:int

Examples

>>> from arch.univariate import HARCH

Lag-1 HARCH, which is identical to an ARCH(1)

>>> harch = HARCH()

More useful and realistic lag lengths

>>> harch = HARCH(lags=[1, 5, 22])

Notes

In a Heterogeneous ARCH process, variance dynamics are

\[\sigma_{t}^{2}=\omega + \sum_{i=1}^{m}\alpha_{l_{i}} \left(l_{i}^{-1}\sum_{j=1}^{l_{i}}\epsilon_{t-j}^{2}\right)\]

In the common case where lags=[1,5,22], the model is

\[\sigma_{t}^{2}=\omega+\alpha_{1}\epsilon_{t-1}^{2} +\alpha_{5} \left(\frac{1}{5}\sum_{j=1}^{5}\epsilon_{t-j}^{2}\right) +\alpha_{22} \left(\frac{1}{22}\sum_{j=1}^{22}\epsilon_{t-j}^{2}\right)\]

A HARCH process is a special case of an ARCH process where parameters in the more general ARCH process have been restricted.

backcast(resids)

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

MIDAS Hyperbolic

class arch.univariate.MIDASHyperbolic(m=22, asym=False)[source]

MIDAS Hyperbolic ARCH process

Parameters:
  • m (int) – Length of maximum lag to include in the model
  • asym (bool) – Flag indicating whether to include an asymmetric term
num_params

The number of parameters in the model

Type:int

Examples

>>> from arch.univariate import MIDASHyperbolic

22-lag MIDAS Hyperbolic process

>>> harch = MIDASHyperbolic()

Longer 66-period lag

>>> harch = MIDASHyperbolic(m=66)

Asymmetric MIDAS Hyperbolic process

>>> harch = MIDASHyperbolic(asym=True)

Notes

In a MIDAS Hyperbolic process, the variance evolves according to

\[\sigma_{t}^{2}=\omega+ \sum_{i=1}^{m}\left(\alpha+\gamma I\left[\epsilon_{t-j}<0\right]\right) \phi_{i}(\theta)\epsilon_{t-i}^{2}\]

where

\[\phi_{i}(\theta) \propto \Gamma(i+\theta)/(\Gamma(i+1)\Gamma(\theta))\]

where \(\Gamma\) is the gamma function. \(\{\phi_i(\theta)\}\) is normalized so that \(\sum \phi_i(\theta)=1\)

References

[*]Foroni, Claudia, and Massimiliano Marcellino. “A survey of Econometric Methods for Mixed-Frequency Data”. Norges Bank. (2013).
[†]Sheppard, Kevin. “Direct volatility modeling”. Manuscript. (2018).
backcast(resids)

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Constraints

Notes

Parameters are (omega, alpha, gamma, theta)

A.dot(parameters) - b >= 0

  1. omega >0
  2. alpha>0 or alpha + gamma > 0
  3. alpha<1 or alpha+0.5*gamma<1
  4. theta > 0
  5. theta < 1
simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

ARCH

class arch.univariate.ARCH(p=1)[source]

ARCH process

Parameters:p (int) – Order of the symmetric innovation
num_params

The number of parameters in the model

Type:int

Examples

ARCH(1) process

>>> from arch.univariate import ARCH

ARCH(5) process

>>> arch = ARCH(p=5)

Notes

The variance dynamics of the model estimated

\[\sigma_t^{2}=\omega+\sum_{i=1}^{p}\alpha_{i}\epsilon_{t-i}^{2}\]
backcast(resids)

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

Parameterless Variance Processes

Some volatility processes use fixed parameters and so have no parameters that are estimable.

EWMA Variance

class arch.univariate.EWMAVariance(lam=0.94)[source]

Bases: arch.univariate.volatility.VolatilityProcess

Exponentially Weighted Moving-Average (RiskMetrics) Variance process

Parameters:lam ({float, None}, optional) – Smoothing parameter. Default is 0.94. Set to None to estimate lam jointly with other model parameters
num_params

The number of parameters in the model

Type:int

Examples

Daily RiskMetrics EWMA process

>>> from arch.univariate import EWMAVariance
>>> rm = EWMAVariance(0.94)

Notes

The variance dynamics of the model

\[\sigma_t^{2}=\lambda\sigma_{t-1}^2 + (1-\lambda)\epsilon^2_{t-1}\]

When lam is provided, this model has no parameters since the smoothing parameter is treated as fixed. Set lam to None to jointly estimate this parameter when fitting the model.

backcast(resids)

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Value to use in backcasting in the volatility recursion
Return type:float
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

RiskMetrics (2006)

class arch.univariate.RiskMetrics2006(tau0=1560, tau1=4, kmax=14, rho=1.4142135623730951)[source]

Bases: arch.univariate.volatility.VolatilityProcess

RiskMetrics 2006 Variance process

Parameters:
  • tau0 (int, optional) – Length of long cycle. Default is 1560.
  • tau1 (int, optional) – Length of short cycle. Default is 4.
  • kmax (int, optional) – Number of components. Default is 14.
  • rho (float, optional) – Relative scale of adjacent cycles. Default is sqrt(2)
num_params

The number of parameters in the model

Type:int

Examples

Daily RiskMetrics 2006 process

>>> from arch.univariate import RiskMetrics2006
>>> rm = RiskMetrics2006()

Notes

The variance dynamics of the model are given as a weighted average of kmax EWMA variance processes where the smoothing parameters and weights are determined by tau0, tau1 and rho.

This model has no parameters since the smoothing parameter is fixed.

backcast(resids)[source]

Construct values for backcasting to start the recursion

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:backcast – Backcast values for each EWMA component
Return type:ndarray
bounds(resids)[source]

Returns bounds for parameters

Parameters:resids (ndarray) – Vector of (approximate) residuals
Returns:bounds – List of bounds where each element is (lower, upper).
Return type:list[tuple[float,float]]
compute_variance(parameters, resids, sigma2, backcast, var_bounds)[source]

Compute the variance for the ARCH model

Parameters:
  • parameters (ndarray) – Model parameters
  • resids (ndarray) – Vector of mean zero residuals
  • sigma2 (ndarray) – Array with same size as resids to store the conditional variance
  • backcast ({float, ndarray}) – Value to use when initializing ARCH recursion. Can be an ndarray when the model contains multiple components.
  • var_bounds (ndarray) – Array containing columns of lower and upper bounds
constraints()[source]

Construct parameter constraints arrays for parameter estimation

Returns:
  • A (ndarray) – Parameters loadings in constraint. Shape is number of constraints by number of parameters
  • b (ndarray) – Constraint values, one for each constraint

Notes

Values returned are used in constructing linear inequality constraints of the form A.dot(parameters) - b >= 0

simulate(parameters, nobs, rng, burn=500, initial_value=None)[source]

Simulate data from the model

Parameters:
  • parameters ({ndarray, Series}) – Parameters required to simulate the volatility model
  • nobs (int) – Number of data points to simulate
  • rng (callable) – Callable function that takes a single integer input and returns a vector of random numbers
  • burn (int, optional) – Number of additional observations to generate when initializing the simulation
  • initial_value ({float, ndarray}, optional) – Scalar or array of initial values to use when initializing the simulation
Returns:

  • resids (ndarray) – The simulated residuals
  • variance (ndarray) – The simulated variance

starting_values(resids)[source]

Returns starting values for the ARCH model

Parameters:resids (ndarray) – Array of (approximate) residuals to use when computing starting values
Returns:sv – Array of starting values
Return type:ndarray

FixedVariance

The FixedVariance class is a special-purpose volatility process that allows the so-called zig-zag algorithm to be used. See the example for usage.

class arch.univariate.FixedVariance(variance, unit_scale=False)[source]

Bases: arch.univariate.volatility.VolatilityProcess

Fixed volatility process

Parameters:
  • variance ({array, Series}) – Array containing the variances to use. Should have the same shape as the data used in the model.
  • unit_scale (bool, optional) – Flag whether to enforce a unit scale. If False, a scale parameter will be estimated so that the model variance will be proportional to variance. If True, the model variance is set of variance

Notes

Allows a fixed set of variances to be used when estimating a mean model, allowing GLS estimation.

Writing New Volatility Processes

All volatility processes must inherit from :class:VolatilityProcess and provide all public methods.

class arch.univariate.volatility.VolatilityProcess[source]

Abstract base class for ARCH models. Allows the conditional mean model to be specified separately from the conditional variance, even though parameters are estimated jointly.