# NAG FL Interfaceg13fff (uni_​garch_​gjr_​forecast)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

g13fff forecasts the conditional variances, ${h}_{t}$, for $\mathit{t}=T+1,\dots ,T+\xi$ from a GJR $\text{GARCH}\left(p,q\right)$ sequence, where $\xi$ is the forecast horizon and $T$ is the current time (see Glosten et al. (1993)).

## 2Specification

Fortran Interface
 Subroutine g13fff ( num, nt, ip, iq, fht, ht, et,
 Integer, Intent (In) :: num, nt, ip, iq Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: theta(iq+ip+1), gamma, ht(num), et(num) Real (Kind=nag_wp), Intent (Out) :: fht(nt)
#include <nag.h>
 void g13fff_ (const Integer *num, const Integer *nt, const Integer *ip, const Integer *iq, const double theta[], const double *gamma, double fht[], const double ht[], const double et[], Integer *ifail)
The routine may be called by the names g13fff or nagf_tsa_uni_garch_gjr_forecast.

## 3Description

Assume the $\text{GARCH}\left(p,q\right)$ process can be represented by:
 $ht = α0 + ∑ i=1 q (αi+γIt-i) ε t-i 2 + ∑ i=1 p βi ht-i , t=1,2,…,T .$
where ${\epsilon }_{t}\mid {\psi }_{t-1}=N\left(0,{h}_{t}\right)$ or ${\epsilon }_{t}\mid {\psi }_{t-1}={S}_{t}\left(\mathit{df},{h}_{t}\right)$, and ${I}_{t}=1$, if ${\epsilon }_{t}<0$, or ${I}_{t}=0$, if ${\epsilon }_{t}\ge 0$, has been modelled by g13fef, and the estimated conditional variances and residuals are contained in the arrays ht and et respectively.
g13fff will then use the last $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(p,q\right)$ elements of the arrays ht and et to estimate the conditional variance forecasts, ${h}_{t}\mid {\psi }_{T}$, where $t=T+1,\dots ,T+\xi$ and $\xi$ is the forecast horizon.

## 4References

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

## 5Arguments

1: $\mathbf{num}$Integer Input
On entry: the number of terms in the arrays ht and et from the modelled sequence.
Constraint: $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)\le {\mathbf{num}}$.
2: $\mathbf{nt}$Integer Input
On entry: $\xi$, the forecast horizon.
Constraint: ${\mathbf{nt}}>0$.
3: $\mathbf{ip}$Integer Input
On entry: the number of coefficients, ${\beta }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,p$.
Constraints:
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)\le 20$;
• ${\mathbf{ip}}\ge 0$.
4: $\mathbf{iq}$Integer Input
On entry: the number of coefficients, ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$.
Constraints:
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)\le 20$;
• ${\mathbf{iq}}\ge 1$.
5: $\mathbf{theta}\left({\mathbf{iq}}+{\mathbf{ip}}+1\right)$Real (Kind=nag_wp) array Input
On entry: the first element must contain the coefficient ${\alpha }_{o}$ and the next iq elements must contain the coefficients ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$. The remaining ip elements must contain the coefficients ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
6: $\mathbf{gamma}$Real (Kind=nag_wp) Input
On entry: the asymmetry parameter $\gamma$ for the $\text{GARCH}\left(p,q\right)$ sequence.
7: $\mathbf{fht}\left({\mathbf{nt}}\right)$Real (Kind=nag_wp) array Output
On exit: the forecast values of the conditional variance, ${h}_{t}$, for $\mathit{t}=T+1,\dots ,T+\xi$.
8: $\mathbf{ht}\left({\mathbf{num}}\right)$Real (Kind=nag_wp) array Input
On entry: the sequence of past conditional variances for the $\text{GARCH}\left(p,q\right)$ process, ${h}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$.
9: $\mathbf{et}\left({\mathbf{num}}\right)$Real (Kind=nag_wp) array Input
On entry: the sequence of past residuals for the $\text{GARCH}\left(p,q\right)$ process, ${\epsilon }_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$.
10: $\mathbf{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 $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{ip}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ip}}\ge 0$.
On entry, ${\mathbf{iq}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{iq}}\ge 1$.
On entry, $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)=⟨\mathit{\text{value}}⟩$.
Constraint: $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)\le 20$.
On entry, ${\mathbf{nt}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nt}}>0$.
On entry, ${\mathbf{num}}=⟨\mathit{\text{value}}⟩$.
Constraint: $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)\le {\mathbf{num}}$.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable

## 8Parallelism and Performance

g13fff is not threaded in any implementation.