NAG CL Interface
g05pgc (times_​garch_​exp)

Settings help

CL Name Style:

1 Purpose

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

2 Specification

#include <nag.h>
void  g05pgc (Nag_ErrorDistn dist, Integer num, Integer ip, Integer iq, const double theta[], Integer df, double ht[], double et[], Nag_Boolean fcall, double r[], Integer lr, Integer state[], NagError *fail)
The function may be called by the names: g05pgc, nag_rand_times_garch_exp or nag_rand_egarch.

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 functions g05kfc (for a repeatable sequence if computed sequentially) or g05kgc (for a non-repeatable sequence) must be called prior to the first call to g05pgc.

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 Nag_ErrorDistn Input
On entry: the type of distribution to use for εt.
A Normal distribution is used.
A Student's t-distribution is used.
Constraint: dist=Nag_NormalDistn or Nag_Tdistn.
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] const double 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.
  • i=1 p βi1.0;
  • α0 1- i=1 p βi - log(nag_real_safe_small_number) .
6: df Integer Input
On entry: the number of degrees of freedom for the Student's t-distribution.
If dist=Nag_NormalDistn, df is not referenced.
Constraint: if dist=Nag_Tdistn, df>2.
7: ht[num] double Output
On exit: the conditional variances ht, for t=1,2,,T, for the GARCH(p,q) sequence.
8: et[num] double Output
On exit: the observations εt, for t=1,2,,T, for the GARCH(p,q) sequence.
9: fcall Nag_Boolean Input
On entry: if fcall=Nag_TRUE, a new sequence is to be generated, otherwise a given sequence is to be continued using the information in r.
10: r[lr] double Communication Array
On entry: the array contains information required to continue a sequence if fcall=Nag_FALSE.
On exit: contains information that can be used in a subsequent call of g05pgc, with fcall=Nag_FALSE.
11: lr Integer Input
On entry: the dimension of the array r.
Constraint: lr2×(ip+2×iq+2).
12: state[dim] Integer Communication Array
Note: the dimension, dim, of this array is dictated by the requirements of associated functions that must have been previously called. This array MUST be the same array passed as argument state in the previous call to nag_rand_init_repeatable (g05kfc) or nag_rand_init_nonrepeatable (g05kgc).
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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument value had an illegal value.
On entry, df=value.
Constraint: df3.
On entry, ip=value.
Constraint: ip0.
On entry, iq=value.
Constraint: iq1.
On entry, lr is not large enough, lr=value: minimum length required =value.
On entry, num=value.
Constraint: num0.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
On entry, state vector has been corrupted or not initialized.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
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.
Invalid sequence generated, use different parameters.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g05pgc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments


10 Example

This example first calls g05kfc to initialize a base generator then calls g05pgc to generate two realizations, each consisting of ten observations, from an exponential GARCH(1,1) model.

10.1 Program Text

Program Text (g05pgce.c)

10.2 Program Data


10.3 Program Results

Program Results (g05pgce.r)