﻿ g13fd Method
g13fd forecasts the conditional variances, ${h}_{t},t=T+1,\dots ,T+\xi$ from a type II $\text{AGARCH}\left(p,q\right)$ sequence, where $\xi$ is the forecast horizon and $T$ is the current time (see Engle and Ng (1993)).

# Syntax

C#
```public static void g13fd(
int num,
int nt,
int ip,
int iq,
double[] theta,
double gamma,
double[] fht,
double[] ht,
double[] et,
out int ifail
)```
Visual Basic
```Public Shared Sub g13fd ( _
num As Integer, _
nt As Integer, _
ip As Integer, _
iq As Integer, _
theta As Double(), _
gamma As Double, _
fht As Double(), _
ht As Double(), _
et As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g13fd(
int num,
int nt,
int ip,
int iq,
array<double>^ theta,
double gamma,
array<double>^ fht,
array<double>^ ht,
array<double>^ et,
[OutAttribute] int% ifail
)```
F#
```static member g13fd :
num : int *
nt : int *
ip : int *
iq : int *
theta : float[] *
gamma : float *
fht : float[] *
ht : float[] *
et : float[] *
ifail : int byref -> unit
```

#### Parameters

num
Type: System..::..Int32
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}}$.
nt
Type: System..::..Int32
On entry: $\xi$, the forecast horizon.
Constraint: ${\mathbf{nt}}>0$.
ip
Type: System..::..Int32
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$.
iq
Type: System..::..Int32
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$.
theta
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{iq}}+{\mathbf{ip}}+1$]
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$.
gamma
Type: System..::..Double
On entry: the asymmetry parameter $\gamma$ for the $\text{GARCH}\left(p,q\right)$ sequence.
fht
Type: array<System..::..Double>[]()[][]
An array of size [nt]
On exit: the forecast values of the conditional variance, ${h}_{t}$, for $\mathit{t}=T+1,\dots ,T+\xi$.
ht
Type: array<System..::..Double>[]()[][]
An array of size [num]
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$.
et
Type: array<System..::..Double>[]()[][]
An array of size [num]
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$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

Assume the $\text{GARCH}\left(p,q\right)$ process can be represented by:
 $ht=α0+∑i=1qαiεt-i+γεt-i2+∑i=1pβiht-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)$, has been modelled by g13fc and the estimated conditional variances and residuals are contained in the arrays ht and et respectively.
g13fd 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.

# 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
Hamilton J (1994) Time Series Analysis Princeton University Press

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{num}}<\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)$, or ${\mathbf{iq}}<1$, or ${\mathbf{ip}}<0$, or $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)>20$, or ${\mathbf{nt}}\le 0$.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

Not applicable.

None.