NAG FL Interface
g05pgf (times_​garch_​exp)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

g05pgf generates a given number of terms of an exponential GARCH(p,q) process (see Engle and Ng (1993)).

2 Specification

Fortran Interface
Subroutine g05pgf ( dist, num, ip, iq, theta, df, ht, et, fcall, r, lr, state, ifail)
Integer, Intent (In) :: num, ip, iq, df, lr
Integer, Intent (Inout) :: state(*), ifail
Real (Kind=nag_wp), Intent (In) :: theta(2*iq+ip+1)
Real (Kind=nag_wp), Intent (Inout) :: r(lr)
Real (Kind=nag_wp), Intent (Out) :: ht(num), et(num)
Logical, Intent (In) :: fcall
Character (1), Intent (In) :: dist
C Header Interface
#include <nag.h>
void  g05pgf_ (const char *dist, const Integer *num, const Integer *ip, const Integer *iq, const double theta[], const Integer *df, double ht[], double et[], const logical *fcall, double r[], const Integer *lr, Integer state[], Integer *ifail, const Charlen length_dist)
The routine may be called by the names g05pgf or nagf_rand_times_garch_exp.

3 Description

An exponential GARCH(p,q) process is represented by:
ln(ht)=α0+i=1qαizt-i+i=1qϕi(|zt-i|-E[|zt-i|])+j=1pβjln(ht-j),  t=1,2,,T;  
where zt= εtht , E[|zt-i|] denotes the expected value of |zt-i|, and εtψt-1=N(0,ht) or εtψt-1=St(df,ht). Here St is a standardized Student's t-distribution with df degrees of freedom and variance ht, T is the number of observations in the sequence, εt is the observed value of the GARCH(p,q) process at time t, ht is the conditional variance at time t, and ψt the set of all information up to time t.
One of the initialization routines g05kff (for a repeatable sequence if computed sequentially) or g05kgf (for a non-repeatable sequence) must be called prior to the first call to g05pgf.

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 Arguments

1: dist Character(1) Input
On entry: the type of distribution to use for εt.
dist='N'
A Normal distribution is used.
dist='T'
A Student's t-distribution is used.
Constraint: dist='N' or 'T'.
2: num Integer Input
On entry: T, the number of terms in the sequence.
Constraint: num0.
3: ip Integer Input
On entry: the number of coefficients, βi, for i=1,2,,p.
Constraint: ip0.
4: iq Integer Input
On entry: the number of coefficients, αi, for i=1,2,,q.
Constraint: iq1.
5: theta(2×iq+ip+1) Real (Kind=nag_wp) array Input
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 must contain the coefficients ϕi, for i=1,2,,q. The next ip elements must contain the moving average coefficients βj, for j=1,2,,p.
Constraints:
  • i=1 p βi1.0;
  • α0 1- i=1 p βi - log(x02amf) .
6: df Integer Input
On entry: the number of degrees of freedom for the Student's t-distribution.
If dist='N', df is not referenced.
Constraint: if dist='T', df>2.
7: ht(num) Real (Kind=nag_wp) array Output
On exit: the conditional variances ht, for t=1,2,,T, for the GARCH(p,q) sequence.
8: et(num) Real (Kind=nag_wp) array Output
On exit: the observations εt, for t=1,2,,T, for the GARCH(p,q) sequence.
9: fcall Logical Input
On entry: if fcall=.TRUE., a new sequence is to be generated, otherwise a given sequence is to be continued using the information in r.
10: r(lr) Real (Kind=nag_wp) array Communication Array
On entry: the array contains information required to continue a sequence if fcall=.FALSE..
On exit: contains information that can be used in a subsequent call of g05pgf, with fcall=.FALSE..
11: lr Integer Input
On entry: the dimension of the array r as declared in the (sub)program from which g05pgf is called.
Constraint: lr2×(ip+2×iq+2).
12: state(*) Integer array Communication Array
Note: the actual argument supplied must be the array state supplied to the initialization routines g05kff or g05kgf.
On entry: contains information on the selected base generator and its current state.
On exit: contains updated information on the state of the generator.
13: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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).
Errors or warnings detected by the routine:
ifail=1
On entry, dist is not valid: dist=value.
ifail=2
On entry, num=value.
Constraint: num0.
ifail=3
On entry, ip=value.
Constraint: ip0.
ifail=4
On entry, iq=value.
Constraint: iq1.
ifail=6
On entry, df=value.
Constraint: df3.
ifail=10
ip or iq is not the same as when r was set up in a previous call.
Previous value of ip=value and ip=value.
Previous value of iq=value and iq=value.
ifail=11
On entry, lr is not large enough, lr=value: minimum length required =value.
ifail=12
On entry, state vector has been corrupted or not initialized.
ifail=20
Invalid sequence generated, use different parameters.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g05pgf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
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 first calls g05kff to initialize a base generator then calls g05pgf to generate two realizations, each consisting of ten observations, from an exponential GARCH(1,1) model.

10.1 Program Text

Program Text (g05pgfe.f90)

10.2 Program Data

Program Data (g05pgfe.d)

10.3 Program Results

Program Results (g05pgfe.r)