## GARCH Models | Extreme Optimization Numerical Libraries for .NET Professional |

GARCH models are used to model time series where the volatility or variance of the errors is not constant. This is often the case in financial time series.

The simplest models only have auto-regressive terms and are called ARCH(q) models, where q is the autoregressive order. A GARCH(p,q) model is a generalization of an ARCH(q) model, with p additional terms corresponding to past conditional variances.

GARCH models are implemented by the GarchModel class.

The GarchModel
class has two constructors. The first takes two arguments and is used
to construct an ARCH(q) model. The first argument is a
Vector

The second constructor takes three arguments and is used to construct
a GARCH(p,q) model. The first argument is once again the
Vector

There are several choices for the distribution of the error terms or innovations. The distribution can be set through the InnovationDistribution property. This property is of type GarchInnovationDistribution, which can have the following values:

Value | Description |
---|---|

Normal | The innovations follow a standard normal distribution. |

StudentT | The innovations follow a student-t distribution where the degrees of freedom of the distribution is estimated along with the other parameters in the model. |

StudentTWithFixedDegreesOfFreedom | The innovations follow a student-t distribution where the degrees of freedom has a fixed value. |

When the degrees of freedom is fixed, it must be set using the StudentTDegreesOfFreedom property. The following example creates a GARCH(1,1) model. The innovation distribution is a student-t distribution with 10 degrees of freedom:

var model2 = new GarchModel(y, 1, 1); model2.InnovationDistribution = GarchInnovationDistribution.StudentTWithFixedDegreesOfFreedom; model2.StudentTDegreesOfFreedom = 10;

The Compute method estimates the parameters of the model using conditional maximum likelihood estimation.

The parameters of the model can be retrieved through the Parameters collection. The first p parameters are the coefficients of the autoregressive components. The next q parameters are the coefficients of the moving average components. If the degrees of freedom of the student-t distribution of the innovations was estimated also, it is returned as the last parameter. The coefficients can also be retrieved separately through the GarchParameters and ArchParameters properties.

The members of these collections are of type
Parameter

model1.Fit(); Console.WriteLine("Constant: {0}", model2.Parameters[0].Value); Console.WriteLine("ARCH(1): {0}", model2.Parameters[1].Value); Console.WriteLine("GARCH(1): {0}", model2.Parameters[2].Value); Console.WriteLine(model2.ParameterValues);

Because a GARCH model is computed by directly maximizing the likelihood function, it does not have the same range of diagnostic values available for linear regression models. Still, a number of standard measures are available.

The LogLikelihood method returns the logarithm of the likelihood of the computed model. The GetAkaikeInformationCriterion method returns the Akaike Information Criterion (AIC) value. This is commonly used to compare different models. The GetBayesianInformationCriterion method returns the Bayesian Information Criterion (BIC) value, which is sometimes used instead of the AIC.

var ll = model2.LogLikelihood; var aic = model2.GetAkaikeInformationCriterion(); var bic = model2.GetBayesianInformationCriterion();

Once the model has been computed, the Forecast method can then be used to forecast new values. This method has three overloads.

Without arguments, the method returns the one step ahead forecast based on
the computed model. With a single argument, it computes a point forecast
the specified number of steps ahead. It returns a
Vector

The third overload takes two additional arguments that specify pre-sample data.
This is data from time periods before the current observation period.
The first is a Vector

#### Reference

Copyright Â© 2004-2023,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.