nag_rand_egarch (g05pgc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_rand_egarch (g05pgc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagg05.h>
void  nag_rand_egarch (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)

3  Description

An exponential GARCHp,q process is represented by:
lnht=α0+i=1qαizt-i+i=1qϕizt-i-Ezt-i+j=1pβjlnht-j,  t=1,2,,T;
where zt= εtht , 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 observations in the sequence, εt is the observed value of the GARCHp,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 nag_rand_init_repeatable (g05kfc) (for a repeatable sequence if computed sequentially) or nag_rand_init_nonrepeatable (g05kgc) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_egarch (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:     distNag_ErrorDistnInput
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:     numIntegerInput
On entry: T, the number of terms in the sequence.
Constraint: num0.
3:     ipIntegerInput
On entry: the number of coefficients, βi, for i=1,2,,p.
Constraint: ip0.
4:     iqIntegerInput
On entry: the number of coefficients, αi, for i=1,2,,q.
Constraint: iq1.
5:     theta[2×iq+ip+1]const doubleInput
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 -lognag_real_safe_small_number.
6:     dfIntegerInput
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]doubleOutput
On exit: the conditional variances ht, for t=1,2,,T, for the GARCHp,q sequence.
8:     et[num]doubleOutput
On exit: the observations εt, for t=1,2,,T, for the GARCHp,q sequence.
9:     fcallNag_BooleanInput
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]doubleInput/Output
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 nag_rand_egarch (g05pgc), with fcall=Nag_FALSE.
11:   lrIntegerInput
On entry: the dimension of the array r.
Constraint: lr2×ip+2×iq+2.
12:   state[dim]IntegerCommunication Array
Note: the actual argument supplied must be the array state supplied to the initialization functions 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:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

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.
On entry, state vector has been corrupted or not initialized.
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  Further Comments


9  Example

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

9.1  Program Text

Program Text (g05pgce.c)

9.2  Program Data


9.3  Program Results

Program Results (g05pgce.r)

nag_rand_egarch (g05pgc) (PDF version)
g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

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