GARCH Models

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.

Creating GARCH Models

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<T> that contains the time series data. The second argument is the autoregressive order.

C#
var model1 = new GarchModel(y, 2);

The second constructor takes three arguments and is used to construct a GARCH(p,q) model. The first argument is once again the Vector<T> that contains the time series data. The remaining parameters are the number of conditional variance terms p and the autoregressive order q.

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:

T:Numerics.NET.Statistics.TimeSeriesAnalysis.GarchInnovationDistribution 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:

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

Computing the Model

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<T>, and can be used to obtain a wide range of information about the computed values, including the standard error, significance tests and confidence intervals.

C#
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);

Verifying the Quality of the Model

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.

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

Forecasting

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<T> that contains the point forecast for the specified number of periods.

C#
var forecast = model2.Forecast(4);

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<T> that contains the pre-sample responses. The second is a Vector<T> that contains the pre-sample innovations. Either or both of these can be null. In that case, the values computed during model estimation are used.

See Also