G13FAF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G13FAF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

G13FAF estimates the parameters of either a standard univariate regression GARCH process, or a univariate regression-type I AGARCHp,q process (see Engle and Ng (1993)).

2  Specification

SUBROUTINE G13FAF ( DIST, YT, X, LDX, NUM, IP, IQ, NREG, MN, ISYM, NPAR, THETA, SE, SC, COVR, LDCOVR, HP, ET, HT, LGF, COPTS, MAXIT, TOL, WORK, LWORK, IFAIL)
INTEGER  LDX, NUM, IP, IQ, NREG, MN, ISYM, NPAR, LDCOVR, MAXIT, LWORK, IFAIL
REAL (KIND=nag_wp)  YT(NUM), X(LDX,*), THETA(NPAR), SE(NPAR), SC(NPAR), COVR(LDCOVR,NPAR), HP, ET(NUM), HT(NUM), LGF, TOL, WORK(LWORK)
LOGICAL  COPTS(2)
CHARACTER(1)  DIST

3  Description

A univariate regression-type I AGARCHp,q process, with q coefficients αi, for i=1,2,,q, p coefficients βi, for i=1,2,,p, and k linear regression coefficients bi, for i=1,2,,k, can be represented by:
yt = bo + xtT b + εt (1)
ht=α0+i=1qαi εt-i+γ 2+i=1pβiht-i,  t=1,2,,T (2)
where εtψt-1=N0,ht or εtψt-1=Stdf,ht. Here St is a standardized Student's t-distribution with df degrees of freedom and variance ht, T is the number of terms in the sequence, yt denotes the endogenous variables, xt the exogenous variables, bo the regression mean, b the regression coefficients, εt the residuals, ht the conditional variance, df the number of degrees of freedom of the Student's t-distribution, and ψt the set of all information up to time t.
G13FAF provides an estimate for θ^, the parameter vector θ=bo,bT,ωT where bT=b1,,bk, ωT=α0,α1,,αq,β1,,βp,γ when DIST='N' and ωT=α0,α1,,αq,β1,,βp,γ,df when DIST='T'.
ISYM, MN and NREG can be used to simplify the GARCHp,q expression in (1) as follows:
No Regression and No Mean
No Regression
Note:  if the yt=μ+εt, where μ is known (not to be estimated by G13FAF) then (1) can be written as ytμ=εt, where ytμ=yt-μ. This corresponds to the case No Regression and No Mean, with yt replaced by yt-μ.
No Mean

4  References

Bollerslev T (1986) Generalised autoregressive conditional heteroskedasticity Journal of Econometrics 31 307–327
Engle R (1982) Autoregressive conditional heteroskedasticity with estimates of the variance of United Kingdom inflation Econometrica 50 987–1008
Engle R and Ng V (1993) Measuring and testing the impact of news on volatility Journal of Finance 48 1749–1777
Hamilton J (1994) Time Series Analysis Princeton University Press

5  Parameters

1:     DIST – CHARACTER(1)Input
On entry: the type of distribution to use for et.
DIST='N'
A Normal distribution is used.
DIST='T'
A Student's t-distribution is used.
Constraint: DIST='N' or 'T'.
2:     YTNUM – REAL (KIND=nag_wp) arrayInput
On entry: the sequence of observations, yt, for t=1,2,,T.
3:     XLDX* – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array X must be at least NREG.
On entry: row t of X must contain the time dependent exogenous vector xt , where xtT = xt1,,xtk , for t=1,2,,T.
4:     LDX – INTEGERInput
On entry: the first dimension of the array X as declared in the (sub)program from which G13FAF is called.
Constraint: LDXNUM.
5:     NUM – INTEGERInput
On entry: T, the number of terms in the sequence.
Constraints:
  • NUMmaxIP,IQ;
  • NUMNREG+MN.
6:     IP – INTEGERInput
On entry: the number of coefficients, βi, for i=1,2,,p.
Constraint: IP0 (see also NPAR).
7:     IQ – INTEGERInput
On entry: the number of coefficients, αi, for i=1,2,,q.
Constraint: IQ1 (see also NPAR).
8:     NREG – INTEGERInput
On entry: k, the number of regression coefficients.
Constraint: NREG0 (see also NPAR).
9:     MN – INTEGERInput
On entry: if MN=1, the mean term b0 will be included in the model.
Constraint: MN=0 or 1.
10:   ISYM – INTEGERInput
On entry: if ISYM=1, the asymmetry term γ will be included in the model.
Constraint: ISYM=0 or 1.
11:   NPAR – INTEGERInput
On entry: the number of parameters to be included in the model. NPAR=1+IQ+IP+ISYM+MN+NREG when DIST='N', and NPAR=2+IQ+IP+ISYM+MN+NREG when DIST='T'.
Constraint: NPAR<20.
12:   THETANPAR – REAL (KIND=nag_wp) arrayInput/Output
On entry: the initial parameter estimates for the vector θ.
The first element must contain the coefficient αo and the next IQ elements must contain the coefficients αi, for i=1,2,,q.
The next IP elements must contain the coefficients βj, for j=1,2,,p.
If ISYM=1, the next element must contain the asymmetry parameter γ.
If DIST='T', the next element must contain df, the number of degrees of freedom of the Student's t-distribution.
If MN=1, the next element must contain the mean term bo.
If COPTS2=.FALSE., the remaining NREG elements are taken as initial estimates of the linear regression coefficients bi, for i=1,2,,k.
On exit: the estimated values θ^ for the vector θ.
The first element contains the coefficient αo, the next IQ elements contain the coefficients αi, for i=1,2,,q.
The next IP elements are the coefficients βj, for j=1,2,,p.
If ISYM=1, the next element contains the estimate for the asymmetry parameter γ.
If DIST='T', the next element contains an estimate for df, the number of degrees of freedom of the Student's t-distribution.
If MN=1, the next element contains an estimate for the mean term bo.
The final NREG elements are the estimated linear regression coefficients bi, for i=1,2,,k.
13:   SENPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the standard errors for θ^.
The first element contains the standard error for αo. The next IQ elements contain the standard errors for αi, for i=1,2,,q. The next IP elements are the standard errors for βj, for j=1,2,,p.
If ISYM=1, the next element contains the standard error for γ.
If DIST='T', the next element contains the standard error for df, the number of degrees of freedom of the Student's t-distribution.
If MN=1, the next element contains the standard error for bo.
The final NREG elements are the standard errors for bj, for j=1,2,,k.
14:   SCNPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the scores for θ^.
The first element contains the score for αo.
The next IQ elements contain the score for αi, for i=1,2,,q.
The next IP elements are the scores for βj, for j=1,2,,p.
If ISYM=1, the next element contains the score for γ.
If DIST='T', the next element contains the score for df, the number of degrees of freedom of the Student's t-distribution.
If MN=1, the next element contains the score for bo.
The final NREG elements are the scores for bj, for j=1,2,,k.
15:   COVRLDCOVRNPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the covariance matrix of the parameter estimates θ^, that is the inverse of the Fisher Information Matrix.
16:   LDCOVR – INTEGERInput
On entry: the first dimension of the array COVR as declared in the (sub)program from which G13FAF is called.
Constraint: LDCOVRNPAR.
17:   HP – REAL (KIND=nag_wp)Input/Output
On entry: if COPTS2=.FALSE., HP is the value to be used for the pre-observed conditional variance; otherwise HP is not referenced.
On exit: if COPTS2=.TRUE., HP is the estimated value of the pre-observed conditional variance.
18:   ETNUM – REAL (KIND=nag_wp) arrayOutput
On exit: the estimated residuals, εt, for t=1,2,,T.
19:   HTNUM – REAL (KIND=nag_wp) arrayOutput
On exit: the estimated conditional variances, ht, for t=1,2,,T.
20:   LGF – REAL (KIND=nag_wp)Output
On exit: the value of the log-likelihood function at θ^.
21:   COPTS2 – LOGICAL arrayInput
On entry: the options to be used by G13FAF.
COPTS1=.TRUE.
Stationary conditions are enforced, otherwise they are not.
COPTS2=.TRUE.
The routine provides initial parameter estimates of the regression terms, otherwise these are to be provided by you.
22:   MAXIT – INTEGERInput
On entry: the maximum number of iterations to be used by the optimization routine when estimating the GARCHp,q parameters. If MAXIT is set to 0, the standard errors, score vector and variance-covariance are calculated for the input value of θ in THETA; however the value of θ is not updated.
Constraint: MAXIT0.
23:   TOL – REAL (KIND=nag_wp)Input
On entry: the tolerance to be used by the optimization routine when estimating the GARCHp,q parameters.
24:   WORKLWORK – REAL (KIND=nag_wp) arrayWorkspace
25:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which G13FAF is called.
Constraint: LWORKNREG+3×NUM+NPAR+403.
26:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if IFAIL0 on exit, the recommended value is -1. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Note: G13FAF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
IFAIL=1
On entry,NREG<0,
orMN>1,
orMN<0,
orISYM>1,
orISYM<0,
orIQ<1,
orIP<0,
orNPAR20,
orNPAR has an invalid value,
orLDCOVR<NPAR,
orLDX<NUM,
orDIST'N',
orDIST'T',
orMAXIT<0,
orNUM<maxIP,IQ,
orNUM<NREG+MN.
IFAIL=2
On entry,LWORK<NREG+3×NUM+NPAR+403.
IFAIL=3
The matrix X is not full rank.
IFAIL=4
The information matrix is not positive definite.
IFAIL=5
The maximum number of iterations has been reached.
IFAIL=6
The log-likelihood cannot be optimized any further.
IFAIL=7
No feasible model parameters could be found.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

G13FAF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G13FAF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

None.

10  Example

This example fits a GARCH1,1 model with Student's t-distributed residuals to some simulated data.
The process parameter estimates, θ^, are obtained using G13FAF, and a four step ahead volatility estimate is computed using G13FBF.
The data was simulated using G05PDF.

10.1  Program Text

Program Text (g13fafe.f90)

10.2  Program Data

Program Data (g13fafe.d)

10.3  Program Results

Program Results (g13fafe.r)


G13FAF (PDF version)
G13 Chapter Contents
G13 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015