g05 Chapter Contents
g05 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_generate_garchGJR (g05hmc)

## 1  Purpose

nag_generate_garchGJR (g05hmc) generates a given number of a GJR GARCH$\left(p,q\right)$ process (see Glosten et al. (1993)).

## 2  Specification

 #include #include
 void nag_generate_garchGJR (Integer num, Integer p, Integer q, const double theta[], double gamma, double ht[], double et[], Nag_Garch_Fcall_Type fcall, double rvec[], NagError *fail)

## 3  Description

A GJR GARCH$\left(p,q\right)$ process is represented by:
 $ε t ∣ ψ t-1 ∼ N 0, h t$
 $h t = α 0 + ∑ i=1 q α i + γ S t-i ε t-i 2 + ∑ i=1 p β i h t-i , t = 1 , … , T$
where ${S}_{t}=1$, if ${\epsilon }_{t}<0$, and ${S}_{t}=0$, if ${\epsilon }_{t}\ge 0$.
Here $T$ is the number of observations in the sequence, ${\epsilon }_{t}$ is the observed value of the GARCH$\left(p,q\right)$ process at time $t$, ${h}_{t}$ is the conditional variance at time $t$, and ${\psi }_{t}$ the information set of all information up to time $t$. Symmetric GARCH$\left(p,q\right)$ sequences are generated when $\gamma$ is zero, otherwise asymmetric GARCH$\left(p,q\right)$ sequences are generated with $\gamma$ specifying the amount by which negative shocks are to be enhanced.

## 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:     numIntegerInput
On entry: $T$, the number of terms in the sequence.
Constraints:
• ${\mathbf{num}}\ge 1$;
• ${\mathbf{num}}>{\mathbf{p}}+{\mathbf{q}}+1$.
2:     pIntegerInput
On entry: the GARCH$\left(p,q\right)$ argument $p$.
Constraint: ${\mathbf{p}}\ge 0$.
3:     qIntegerInput
On entry: the GARCH$\left(p,q\right)$ argument $q$.
Constraint: ${\mathbf{q}}\ge 1$.
4:     theta[${\mathbf{q}}+{\mathbf{p}}+1$]const doubleInput
On entry: the first element contains the coefficient ${\alpha }_{o}$, the next q elements contain the coefficients ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$. The remaining p elements are the coefficients ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
On entry: the asymmetry argument $\gamma$ for the GARCH$\left(p,q\right)$ sequence.
6:     ht[num]doubleOutput
On exit: the conditional variances ${h}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$ for the GARCH$\left(p,q\right)$ sequence.
7:     et[num]doubleOutput
On exit: the observations ${\epsilon }_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$, or the GARCH$\left(p,q\right)$ sequence.
8:     fcallNag_Garch_Fcall_TypeInput
On entry: if ${\mathbf{fcall}}=\mathrm{Nag_Garch_Fcall_True}$, a new sequence is to be generated, else if ${\mathbf{fcall}}=\mathrm{Nag_Garch_Fcall_False}$ a given sequence is to be continued using the information in rvec.
9:     rvec[$2×\left({\mathbf{p}}+{\mathbf{q}}+1\right)$]doubleInput/Output
On entry: the array contains information required to continue a sequence if ${\mathbf{fcall}}=\mathrm{Nag_Garch_Fcall_False}$.
On exit: contains information that can be used in a subsequent call of nag_generate_garchGJR (g05hmc), with ${\mathbf{fcall}}=\mathrm{Nag_Garch_Fcall_False}$.
10:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

## 6  Error Indicators and Warnings

NE_2_INT_ARG_LT
On entry, ${\mathbf{num}}=〈\mathit{\text{value}}〉$ while ${\mathbf{p}}+{\mathbf{q}}+1=〈\mathit{\text{value}}〉$. These arguments must satisfy ${\mathbf{num}}\ge {\mathbf{p}}+{\mathbf{q}}+1$.
On entry, argument fcall had an illegal value.
On entry, argument gamma had an illegal value.
NE_INT_ARG_LT
On entry, ${\mathbf{num}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{num}}\ge 1$.
On entry, ${\mathbf{p}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{p}}\ge 0$.
On entry, ${\mathbf{q}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{q}}\ge 1$.

Not applicable.