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

NAG Library Routine Document

G13FGF

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

G13FGF estimates the parameters of a univariate regression-exponential GARCHp,q process (see Engle and Ng (1993)).

2  Specification

SUBROUTINE G13FGF ( DIST, YT, X, LDX, NUM, IP, IQ, NREG, MN, NPAR, THETA, SE, SC, COVR, LDCOVR, HP, ET, HT, LGF, COPTS, MAXIT, TOL, WORK, LWORK, IFAIL)
INTEGER  LDX, NUM, IP, IQ, NREG, MN, 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
CHARACTER(1)  DIST

3  Description

A univariate regression-exponential GARCHp,q process, with q coefficients αi, for i=1,2,,q, 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 lnht = α0+ i=1 q αi zt-i + i=1 q ϕi zt-i - E zt-i + i=1 p βi ln ht-i ,   t=1,2,,T (1)
where zt= εt ht , Ezt-i denotes the expected value of zt-i and ε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.
G13FGF provides an estimate θ^, for the vector θ = bo,bT,ωT  where bT = b1,,bk , ωT = α0,α1,,αq,ϕ1,,ϕq,β1,,βp,γ  when DIST='N', and ωT = α0,α1,,αq,ϕ1,,ϕq,β1,,βp,γ,df  when DIST='T'.
MN, 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 G13FGF) 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
Glosten L, Jagannathan R and Runkle D (1993) Relationship between the expected value and the volatility of nominal excess return on stocks Journal of Finance 48 1779–1801
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 G13FGF 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:   NPAR – INTEGERInput
On entry: the number of parameters to be included in the model. NPAR=1+2×IQ+IP+MN+NREG when DIST='N' and NPAR=2+2×IQ+IP+MN+NREG when DIST='T'.
Constraint: NPAR<20.
11:   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 autoregressive coefficients αi, for i=1,2,,q.
The next IQ elements contain the coefficients ϕi, for i=1,2,,q.
The next IP elements must contain the moving average coefficients βi, for i=1,2,,p.
If DIST='T', the next element must contain an estimate for 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 COPTS=.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 and the next IQ elements contain the coefficients αi, for i=1,2,,q.
The next IQ elements contain the coefficients ϕi, for i=1,2,,q.
The next IP elements are the moving average coefficients βi, for i=1,2,,p.
If DIST='T', the next element contains an estimate for df then 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.
12:   SENPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the standard errors for θ^.
The first element contains the standard error for αo and the next IQ elements contain the standard errors for αi, for i=1,2,,q. 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 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.
13:   SCNPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the scores for θ^.
The first element contains the scores for αo, the next IQ elements contain the scores for αi, for i=1,2,,q, the next IQ elements contain the scores for ϕi, for i=1,2,,q, the next IP elements are the scores for βj, for j=1,2,,p.
If DIST='T', the next element contains the scores 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.
14:   COVRLDCOVRNPAR – REAL (KIND=nag_wp) arrayOutput
On exit: the covariance matrix of the parameter estimates θ^, that is the inverse of the Fisher Information Matrix.
15:   LDCOVR – INTEGERInput
On entry: the first dimension of the array COVR as declared in the (sub)program from which G13FGF is called.
Constraint: LDCOVRNPAR.
16:   HP – REAL (KIND=nag_wp)Input/Output
On entry: if COPTS=.FALSE. then HP is the value to be used for the pre-observed conditional variance, otherwise HP is not referenced.
On exit: if COPTS=.TRUE. then HP is the estimated value of the pre-observed conditional variance.
17:   ETNUM – REAL (KIND=nag_wp) arrayOutput
On exit: the estimated residuals, εt, for t=1,2,,T.
18:   HTNUM – REAL (KIND=nag_wp) arrayOutput
On exit: the estimated conditional variances, ht, for t=1,2,,T.
19:   LGF – REAL (KIND=nag_wp)Output
On exit: the value of the log-likelihood function at θ^.
20:   COPTS – LOGICALInput
On entry: if COPTS=.TRUE., the routine provides initial parameter estimates of the regression terms, otherwise these are provided by you.
21:   MAXIT – INTEGERInput
On entry: the maximum number of iterations to be used by the optimization routine when estimating the GARCHp,q parameters.
Constraint: MAXIT>0.
22:   TOL – REAL (KIND=nag_wp)Input
On entry: the tolerance to be used by the optimization routine when estimating the GARCHp,q parameters.
23:   WORKLWORK – REAL (KIND=nag_wp) arrayWorkspace
24:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which G13FGF is called.
Constraint: LWORKNREG+3×NUM+3.
25:   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: G13FGF 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,
orIQ<1,
orIP<0,
orNPAR20,
orNPAR has an invalid value,
orLDCOVR<NPAR,
orLDX<NUM,
orDIST'N',
orDIST'T',
orMAXIT0,
orNUM<maxIP,IQ,
orNUM<NREG+MN.
IFAIL=2
On entry,LWORK<NREG+3×NUM+3.
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

G13FGF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G13FGF 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,2 model with Student's t-distributed residuals to some simulated data.
The process parameter estimates, θ^, are obtained using G13FGF, and a four step ahead volatility estimate is computed using G13FHF.
The data was simulated using G05PGF.

10.1  Program Text

Program Text (g13fgfe.f90)

10.2  Program Data

Program Data (g13fgfe.d)

10.3  Program Results

Program Results (g13fgfe.r)


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

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