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
VectorT
that contains the time series data.
The second argument is the autoregressive order.
var model1 = new GarchModel(y, 2);
Dim model1 = New GarchModel(y, 2)
No code example is currently available or this language may not be supported.
let 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
VectorT
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:Extreme.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:
var model2 = new GarchModel(y, 1, 1);
model2.InnovationDistribution = GarchInnovationDistribution.StudentTWithFixedDegreesOfFreedom;
model2.StudentTDegreesOfFreedom = 10;
Dim model2 = New GarchModel(y, 1, 1)
model2.InnovationDistribution = GarchInnovationDistribution.StudentTWithFixedDegreesOfFreedom
model2.StudentTDegreesOfFreedom = 10
No code example is currently available or this language may not be supported.
let model2 = new GarchModel(y, 1, 1)
model2.InnovationDistribution <- GarchInnovationDistribution.StudentTWithFixedDegreesOfFreedom
model2.StudentTDegreesOfFreedom <- 10.0
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
ParameterT,
and can be used to obtain a wide range of information about the computed
values, including the standard error, significance tests and confidence
intervals.
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);
model2.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)
No code example is currently available or this language may not be supported.
model1.Fit()
printfn "Constant: %f" model2.Parameters.[0].Value
printfn "ARCH(1): %f" model2.Parameters.[1].Value
printfn "GARCH(1): %f" 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.
var ll = model2.LogLikelihood;
var aic = model2.GetAkaikeInformationCriterion();
var bic = model2.GetBayesianInformationCriterion();
Dim ll = model2.LogLikelihood
Dim aic = model2.GetAkaikeInformationCriterion()
Dim bic = model2.GetBayesianInformationCriterion()
No code example is currently available or this language may not be supported.
let ll = model2.LogLikelihood
let aic = model2.GetAkaikeInformationCriterion()
let 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
VectorT
that contains the point forecast for the specified number of periods.
var forecast = model2.Forecast(4);
Dim forecast = model2.Forecast(4)
No code example is currently available or this language may not be supported.
let 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 VectorT
that contains the pre-sample responses.
The second is a VectorT
that contains the pre-sample innovations. Either or both of these
can be . In that case,
the values computed during model estimation are used.
Reference