NAG CL Interface
g05pfc (times_​garch_​gjr)

Settings help

CL Name Style:


1 Purpose

g05pfc generates a given number of terms of a GJR GARCH(p,q) process (see Glosten et al. (1993)).

2 Specification

#include <nag.h>
void  g05pfc (Nag_ErrorDistn dist, Integer num, Integer ip, Integer iq, const double theta[], double gamma, 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: g05pfc, nag_rand_times_garch_gjr or nag_rand_garchgjr.

3 Description

A GJR GARCH(p,q) process is represented by:
ht = α0 + i=1q (αi+γIt-i) ε t-i 2 + i=1 p βi ht-i ,   t=1,2,,T ;  
where It=1 if εt<0, It=0 if εt0, 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. Symmetric GARCH sequences are generated when γ is zero, otherwise asymmetric GARCH sequences are generated with γ specifying the amount by which negative shocks are to be enhanced.
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 g05pfc.

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.
dist=Nag_NormalDistn
A Normal distribution is used.
dist=Nag_Tdistn
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: num>0.
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[iq+ip+1] const double Input
On entry: the first element must contain the coefficient αo, the next iq elements must contain the coefficients αi, for i=1,2,,q. The remaining ip elements must contain the coefficients βj, for j=1,2,,p.
Constraints:
  • i=2 iq+ip+1 theta[i-1]<1.0;
  • theta[i-1]0.0, for i=1 and i=iq+2,,iq+ip+1.
6: gamma double Input
On entry: the asymmetry parameter γ for the GARCH(p,q) sequence.
Constraint: gamma+theta[i-1]0.0, for i=2,3,,iq+1.
7: 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.
8: ht[num] double Output
On exit: the conditional variances ht, for t=1,2,,T, for the GARCH(p,q) sequence.
9: et[num] double Output
On exit: the observations εt, for t=1,2,,T, for the GARCH(p,q) sequence.
10: 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.
11: 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 g05pfc, with fcall=Nag_FALSE.
12: lr Integer Input
On entry: the dimension of the array r.
Constraint: lr2×(ip+iq+2).
13: 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.
14: 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

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
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.
NE_INTERNAL_ERROR
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.
NE_INVALID_STATE
On entry, state vector has been corrupted or not initialized.
NE_NO_LICENCE
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.
NE_PREV_CALL
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.
NE_REAL_2
On entry, theta[value]=value and γ=value.
Constraint: αi+γ0.
NE_REAL_ARRAY
On entry, sum of theta[i]=value.
Constraint: sum of theta[i], for i=1,2,,ip+iq is <1.0.
On entry, theta[value]=value.
Constraint: theta[i]0.0.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
g05pfc 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

None.

10 Example

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

10.1 Program Text

Program Text (g05pfce.c)

10.2 Program Data

None.

10.3 Program Results

Program Results (g05pfce.r)