g05pe generates a given number of terms of a type II $\text{AGARCH}\left(p,q\right)$ process (see Engle and Ng (1993)).

# Syntax

C#
```public static void g05pe(
string dist,
int num,
int ip,
int iq,
double[] theta,
double gamma,
int df,
double[] ht,
double[] et,
bool fcall,
double[] r,
G05..::..G05State g05state,
out int ifail
)```
Visual Basic
```Public Shared Sub g05pe ( _
dist As String, _
num As Integer, _
ip As Integer, _
iq As Integer, _
theta As Double(), _
gamma As Double, _
df As Integer, _
ht As Double(), _
et As Double(), _
fcall As Boolean, _
r As Double(), _
g05state As G05..::..G05State, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void g05pe(
String^ dist,
int num,
int ip,
int iq,
array<double>^ theta,
double gamma,
int df,
array<double>^ ht,
array<double>^ et,
bool fcall,
array<double>^ r,
G05..::..G05State^ g05state,
[OutAttribute] int% ifail
)```
F#
```static member g05pe :
dist : string *
num : int *
ip : int *
iq : int *
theta : float[] *
gamma : float *
df : int *
ht : float[] *
et : float[] *
fcall : bool *
r : float[] *
g05state : G05..::..G05State *
ifail : int byref -> unit
```

#### Parameters

dist
Type: System..::..String
On entry: the type of distribution to use for ${\epsilon }_{t}$.
${\mathbf{dist}}=\text{"N"}$
A Normal distribution is used.
${\mathbf{dist}}=\text{"T"}$
A Student's $t$-distribution is used.
Constraint: ${\mathbf{dist}}=\text{"N"}$ or $\text{"T"}$.
num
Type: System..::..Int32
On entry: $T$, the number of terms in the sequence.
Constraint: ${\mathbf{num}}\ge 0$.
ip
Type: System..::..Int32
On entry: the number of coefficients, ${\beta }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,p$.
Constraint: ${\mathbf{ip}}\ge 0$.
iq
Type: System..::..Int32
On entry: the number of coefficients, ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$.
Constraint: ${\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}$, 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$.
Constraints:
• $\sum _{\mathit{i}=2}^{{\mathbf{iq}}+{\mathbf{ip}}+1}{\mathbf{theta}}\left[\mathit{i}-1\right]<1.0$;
• ${\mathbf{theta}}\left[\mathit{i}-1\right]\ge 0.0$, for $\mathit{i}=2,3,\dots ,{\mathbf{ip}}+{\mathbf{iq}}+1$.
gamma
Type: System..::..Double
On entry: the asymmetry parameter $\gamma$ for the $\text{GARCH}\left(p,q\right)$ sequence.
df
Type: System..::..Int32
On entry: the number of degrees of freedom for the Student's $t$-distribution.
If ${\mathbf{dist}}=\text{"N"}$, df is not referenced.
Constraint: if ${\mathbf{dist}}=\text{"T"}$, ${\mathbf{df}}>2$.
ht
Type: array<System..::..Double>[]()[][]
An array of size [num]
On exit: the conditional variances ${h}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$, for the $\text{GARCH}\left(p,q\right)$ sequence.
et
Type: array<System..::..Double>[]()[][]
An array of size [num]
On exit: the observations ${\epsilon }_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$, for the $\text{GARCH}\left(p,q\right)$ sequence.
fcall
Type: System..::..Boolean
On entry: if ${\mathbf{fcall}}=\mathrm{true}$, a new sequence is to be generated, otherwise a given sequence is to be continued using the information in r.
r
Type: array<System..::..Double>[]()[][]
An array of size [lr]
On entry: the array contains information required to continue a sequence if ${\mathbf{fcall}}=\mathrm{false}$.
On exit: contains information that can be used in a subsequent call of g05pe, with ${\mathbf{fcall}}=\mathrm{false}$.
g05state
Type: NagLibrary..::..G05..::..G05State
An Object of type G05.G05State.
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

A type II $\text{AGARCH}\left(p,q\right)$ process can be represented by:
 $ht=α0+∑ i=1 q αiεt-i+γεt-i2+∑ i=1 p β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)$. Here ${S}_{t}$ is a standardized Student's $t$-distribution with $\mathit{df}$ degrees of freedom and variance ${h}_{t}$, $T$ is the number of observations in the sequence, ${\epsilon }_{t}$ is the observed value of the $\text{GARCH}\left(p,q\right)$ process at time $t$, ${h}_{t}$ is the conditional variance at time $t$, and ${\psi }_{t}$ the set of all information up to time $t$. Symmetric GARCH sequences are generated when $\gamma$ is zero, otherwise asymmetric GARCH sequences are generated with $\gamma$ specifying the amount by which positive (or negative) shocks are to be enhanced.
One of the initialization methods (G05KFF not in this release) (for a repeatable sequence if computed sequentially) or (G05KGF not in this release) (for a non-repeatable sequence) must be called prior to the first call to g05pe.

# 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{dist}}\ne \text{"N"}$ or $\text{"T"}$.
${\mathbf{ifail}}=2$
 On entry, ${\mathbf{num}}<0$.
${\mathbf{ifail}}=3$
 On entry, ${\mathbf{ip}}<0$.
${\mathbf{ifail}}=4$
 On entry, ${\mathbf{iq}}<1$.
${\mathbf{ifail}}=7$
 On entry, ${\mathbf{dist}}=\text{"T"}$ and ${\mathbf{df}}\le 2$.
${\mathbf{ifail}}=11$
The value of ip or iq is not the same as when r was set up in a previous call.
${\mathbf{ifail}}=12$
 On entry, ${\mathbf{lr}}<2×\left({\mathbf{ip}}+{\mathbf{iq}}+2\right)$.
${\mathbf{ifail}}=13$
 On entry, state vector was not initialized or has been corrupted.
${\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.