NAG FL Interfaceg13faf (uni_​garch_​asym1_​estim)

▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

1Purpose

g13faf estimates the parameters of either a standard univariate regression GARCH process, or a univariate regression-type I $\text{AGARCH}\left(p,q\right)$ process (see Engle and Ng (1993)).

2Specification

Fortran Interface
 Subroutine g13faf ( dist, yt, x, ldx, num, ip, iq, nreg, mn, isym, npar, se, sc, covr, pht, et, ht, lgf, tol, work,
 Integer, Intent (In) :: ldx, num, ip, iq, nreg, mn, isym, npar, ldcovr, maxit, lwork Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: yt(num), x(ldx,*), tol Real (Kind=nag_wp), Intent (Inout) :: theta(npar), covr(ldcovr,npar), pht Real (Kind=nag_wp), Intent (Out) :: se(npar), sc(npar), et(num), ht(num), lgf, work(lwork) Logical, Intent (In) :: copts(2) Character (1), Intent (In) :: dist
#include <nag.h>
 void g13faf_ (const char *dist, const double yt[], const double x[], const Integer *ldx, const Integer *num, const Integer *ip, const Integer *iq, const Integer *nreg, const Integer *mn, const Integer *isym, const Integer *npar, double theta[], double se[], double sc[], double covr[], const Integer *ldcovr, double *pht, double et[], double ht[], double *lgf, const logical copts[], const Integer *maxit, const double *tol, double work[], const Integer *lwork, Integer *ifail, const Charlen length_dist)
The routine may be called by the names g13faf or nagf_tsa_uni_garch_asym1_estim.

3Description

A univariate regression-type I $\text{AGARCH}\left(p,q\right)$ process, with $q$ coefficients ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$, $p$ coefficients ${\beta }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,p$, and $k$ linear regression coefficients ${b}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,k$, can be represented by:
 $yt = bo + xtT b + εt$ (1)
 $ht=α0+∑i=1qαi (εt-i+γ) 2+∑i=1pβiht-i, t=1,2,…,T$ (2)
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 terms in the sequence, ${y}_{t}$ denotes the endogenous variables, ${x}_{t}$ the exogenous variables, ${b}_{o}$ the regression mean, $b$ the regression coefficients, ${\epsilon }_{t}$ the residuals, ${h}_{t}$ the conditional variance, $\mathit{df}$ the number of degrees of freedom of the Student's $t$-distribution, and ${\psi }_{t}$ the set of all information up to time $t$.
g13faf provides an estimate for $\stackrel{^}{\theta }$, the parameter vector $\theta =\left({b}_{o},{b}^{\mathrm{T}},{\omega }^{\mathrm{T}}\right)$ where ${b}^{\mathrm{T}}=\left({b}_{1},\dots ,{b}_{k}\right)$, ${\omega }^{\mathrm{T}}=\left({\alpha }_{0},{\alpha }_{1},\dots ,{\alpha }_{q},{\beta }_{1},\dots ,{\beta }_{p},\gamma \right)$ when ${\mathbf{dist}}=\text{'N'}$ and ${\omega }^{\mathrm{T}}=\left({\alpha }_{0},{\alpha }_{1},\dots ,{\alpha }_{q},{\beta }_{1},\dots ,{\beta }_{p},\gamma ,\mathit{df}\right)$ when ${\mathbf{dist}}=\text{'T'}$.
isym, mn and nreg can be used to simplify the $\text{GARCH}\left(p,q\right)$ expression in (1) as follows:
No Regression and No Mean
• ${y}_{t}={\epsilon }_{t}$,
• ${\mathbf{isym}}=0$,
• ${\mathbf{mn}}=0$,
• ${\mathbf{nreg}}=0$ and
• $\theta$ is a $\left(p+q+1\right)$ vector when ${\mathbf{dist}}=\text{'N'}$ and a $\left(p+q+2\right)$ vector when ${\mathbf{dist}}=\text{'T'}$.
No Regression
• ${y}_{t}={b}_{o}+{\epsilon }_{t}$,
• ${\mathbf{isym}}=0$,
• ${\mathbf{mn}}=1$,
• ${\mathbf{nreg}}=0$ and
• $\theta$ is a $\left(p+q+2\right)$ vector when ${\mathbf{dist}}=\text{'N'}$ and a $\left(p+q+3\right)$ vector when ${\mathbf{dist}}=\text{'T'}$.
Note:  if the ${y}_{t}=\mu +{\epsilon }_{t}$, where $\mu$ is known (not to be estimated by g13faf) then (1) can be written as ${y}_{t}^{\mu }={\epsilon }_{t}$, where ${y}_{t}^{\mu }={y}_{t}-\mu$. This corresponds to the case No Regression and No Mean, with ${y}_{t}$ replaced by ${y}_{t}-\mu$.
No Mean
• ${y}_{t}={x}_{t}^{\mathrm{T}}b+{\epsilon }_{t}$,
• ${\mathbf{isym}}=0$,
• ${\mathbf{mn}}=0$,
• ${\mathbf{nreg}}=k$ and
• $\theta$ is a $\left(p+q+k+1\right)$ vector when ${\mathbf{dist}}=\text{'N'}$ and a $\left(p+q+k+2\right)$ vector when ${\mathbf{dist}}=\text{'T'}$.

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

5Arguments

1: $\mathbf{dist}$Character(1) Input
On entry: the type of distribution to use for ${e}_{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'}$.
2: $\mathbf{yt}\left({\mathbf{num}}\right)$Real (Kind=nag_wp) array Input
On entry: the sequence of observations, ${y}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$.
3: $\mathbf{x}\left({\mathbf{ldx}},*\right)$Real (Kind=nag_wp) array Input
Note: the second dimension of the array x must be at least ${\mathbf{nreg}}$.
On entry: row $\mathit{t}$ of x must contain the time dependent exogenous vector ${x}_{\mathit{t}}$, where ${x}_{\mathit{t}}^{\mathrm{T}}=\left({x}_{\mathit{t}}^{1},\dots ,{x}_{\mathit{t}}^{k}\right)$, for $\mathit{t}=1,2,\dots ,T$.
4: $\mathbf{ldx}$Integer Input
On entry: the first dimension of the array x as declared in the (sub)program from which g13faf is called.
Constraint: ${\mathbf{ldx}}\ge {\mathbf{num}}$.
5: $\mathbf{num}$Integer Input
On entry: $T$, the number of terms in the sequence.
Constraints:
• ${\mathbf{num}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{ip}},{\mathbf{iq}}\right)$;
• ${\mathbf{num}}\ge {\mathbf{nreg}}+{\mathbf{mn}}$.
6: $\mathbf{ip}$Integer Input
On entry: the number of coefficients, ${\beta }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,p$.
Constraint: ${\mathbf{ip}}\ge 0$ (see also npar).
7: $\mathbf{iq}$Integer Input
On entry: the number of coefficients, ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$.
Constraint: ${\mathbf{iq}}\ge 1$ (see also npar).
8: $\mathbf{nreg}$Integer Input
On entry: $k$, the number of regression coefficients.
Constraint: ${\mathbf{nreg}}\ge 0$ (see also npar).
9: $\mathbf{mn}$Integer Input
On entry: if ${\mathbf{mn}}=1$, the mean term ${b}_{0}$ will be included in the model.
Constraint: ${\mathbf{mn}}=0$ or $1$.
10: $\mathbf{isym}$Integer Input
On entry: if ${\mathbf{isym}}=1$, the asymmetry term $\gamma$ will be included in the model.
Constraint: ${\mathbf{isym}}=0$ or $1$.
11: $\mathbf{npar}$Integer Input
On entry: the number of parameters to be included in the model. ${\mathbf{npar}}=1+{\mathbf{iq}}+{\mathbf{ip}}+{\mathbf{isym}}+{\mathbf{mn}}+{\mathbf{nreg}}$ when ${\mathbf{dist}}=\text{'N'}$, and ${\mathbf{npar}}=2+{\mathbf{iq}}+{\mathbf{ip}}+{\mathbf{isym}}+{\mathbf{mn}}+{\mathbf{nreg}}$ when ${\mathbf{dist}}=\text{'T'}$.
Constraint: ${\mathbf{npar}}<20$.
12: $\mathbf{theta}\left({\mathbf{npar}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: the initial parameter estimates for the vector $\theta$.
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 next ip elements must contain the coefficients ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
If ${\mathbf{isym}}=1$, the next element must contain the asymmetry parameter $\gamma$.
If ${\mathbf{dist}}=\text{'T'}$, the next element must contain $\mathit{df}$, the number of degrees of freedom of the Student's $t$-distribution.
If ${\mathbf{mn}}=1$, the next element must contain the mean term ${b}_{o}$.
If ${\mathbf{copts}}\left(2\right)=\mathrm{.FALSE.}$, the remaining nreg elements are taken as initial estimates of the linear regression coefficients ${b}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,k$.
On exit: the estimated values $\stackrel{^}{\theta }$ for the vector $\theta$.
The first element contains the coefficient ${\alpha }_{o}$, the next iq elements contain the coefficients ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$.
The next ip elements are the coefficients ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
If ${\mathbf{isym}}=1$, the next element contains the estimate for the asymmetry parameter $\gamma$.
If ${\mathbf{dist}}=\text{'T'}$, the next element contains an estimate for $\mathit{df}$, the number of degrees of freedom of the Student's $t$-distribution.
If ${\mathbf{mn}}=1$, the next element contains an estimate for the mean term ${b}_{o}$.
The final nreg elements are the estimated linear regression coefficients ${b}_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,k$.
13: $\mathbf{se}\left({\mathbf{npar}}\right)$Real (Kind=nag_wp) array Output
On exit: the standard errors for $\stackrel{^}{\theta }$.
The first element contains the standard error for ${\alpha }_{o}$. The next iq elements contain the standard errors for ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$. The next ip elements are the standard errors for ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
If ${\mathbf{isym}}=1$, the next element contains the standard error for $\gamma$.
If ${\mathbf{dist}}=\text{'T'}$, the next element contains the standard error for $\mathit{df}$, the number of degrees of freedom of the Student's $t$-distribution.
If ${\mathbf{mn}}=1$, the next element contains the standard error for ${b}_{o}$.
The final nreg elements are the standard errors for ${b}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,k$.
14: $\mathbf{sc}\left({\mathbf{npar}}\right)$Real (Kind=nag_wp) array Output
On exit: the scores for $\stackrel{^}{\theta }$.
The first element contains the score for ${\alpha }_{o}$.
The next iq elements contain the score for ${\alpha }_{\mathit{i}}$, for $\mathit{i}=1,2,\dots ,q$.
The next ip elements are the scores for ${\beta }_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$.
If ${\mathbf{isym}}=1$, the next element contains the score for $\gamma$.
If ${\mathbf{dist}}=\text{'T'}$, the next element contains the score for $\mathit{df}$, the number of degrees of freedom of the Student's $t$-distribution.
If ${\mathbf{mn}}=1$, the next element contains the score for ${b}_{o}$.
The final nreg elements are the scores for ${b}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,k$.
15: $\mathbf{covr}\left({\mathbf{ldcovr}},{\mathbf{npar}}\right)$Real (Kind=nag_wp) array Output
On exit: the covariance matrix of the parameter estimates $\stackrel{^}{\theta }$, that is the inverse of the Fisher Information Matrix.
16: $\mathbf{ldcovr}$Integer Input
On entry: the first dimension of the array covr as declared in the (sub)program from which g13faf is called.
Constraint: ${\mathbf{ldcovr}}\ge {\mathbf{npar}}$.
17: $\mathbf{pht}$Real (Kind=nag_wp) Input/Output
On entry: if ${\mathbf{copts}}\left(2\right)=\mathrm{.FALSE.}$, pht is the value to be used for the pre-observed conditional variance; otherwise pht is not referenced.
On exit: if ${\mathbf{copts}}\left(2\right)=\mathrm{.TRUE.}$, pht is the estimated value of the pre-observed conditional variance.
18: $\mathbf{et}\left({\mathbf{num}}\right)$Real (Kind=nag_wp) array Output
On exit: the estimated residuals, ${\epsilon }_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$.
19: $\mathbf{ht}\left({\mathbf{num}}\right)$Real (Kind=nag_wp) array Output
On exit: the estimated conditional variances, ${h}_{\mathit{t}}$, for $\mathit{t}=1,2,\dots ,T$.
20: $\mathbf{lgf}$Real (Kind=nag_wp) Output
On exit: the value of the log-likelihood function at $\stackrel{^}{\theta }$.
21: $\mathbf{copts}\left(2\right)$Logical array Input
On entry: the options to be used by g13faf.
${\mathbf{copts}}\left(1\right)=\mathrm{.TRUE.}$
Stationary conditions are enforced, otherwise they are not.
${\mathbf{copts}}\left(2\right)=\mathrm{.TRUE.}$
The routine provides initial parameter estimates of the regression terms, otherwise these are to be provided by you.
22: $\mathbf{maxit}$Integer Input
On entry: the maximum number of iterations to be used by the optimization routine when estimating the $\text{GARCH}\left(p,q\right)$ parameters. If maxit is set to $0$, the standard errors, score vector and variance-covariance are calculated for the input value of $\theta$ in theta when ${\mathbf{dist}}=\text{'N'}$; however the value of $\theta$ is not updated.
Constraint: ${\mathbf{maxit}}\ge 0$.
23: $\mathbf{tol}$Real (Kind=nag_wp) Input
On entry: the tolerance to be used by the optimization routine when estimating the $\text{GARCH}\left(p,q\right)$ parameters.
24: $\mathbf{work}\left({\mathbf{lwork}}\right)$Real (Kind=nag_wp) array Workspace
25: $\mathbf{lwork}$Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which g13faf is called.
Constraint: ${\mathbf{lwork}}\ge \left({\mathbf{nreg}}+3\right)×{\mathbf{num}}+{\mathbf{npar}}+403$.
26: $\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 $-1$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. 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:
Note: in some cases g13faf may return useful information.
${\mathbf{ifail}}=1$
On entry, ${\mathbf{dist}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{dist}}=\text{'N'}$ or $\text{'T'}$.
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, ${\mathbf{isym}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{isym}}=0$ or $1$.
On entry, ${\mathbf{ldcovr}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldcovr}}\ge {\mathbf{npar}}$.
On entry, ${\mathbf{ldx}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ldx}}\ge {\mathbf{num}}$.
On entry, ${\mathbf{maxit}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{maxit}}\ge 0$.
On entry, ${\mathbf{mn}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{mn}}=0$ or $1$.
On entry, ${\mathbf{npar}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{dist}}=\text{'N'}$ then ${\mathbf{npar}}=1+{\mathbf{iq}}+{\mathbf{ip}}+{\mathbf{isym}}+{\mathbf{mn}}+{\mathbf{nreg}}$, else ${\mathbf{npar}}=2+{\mathbf{iq}}+{\mathbf{ip}}+{\mathbf{isym}}+{\mathbf{mn}}+{\mathbf{nreg}}$.
On entry, ${\mathbf{npar}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{npar}}<20$.
On entry, ${\mathbf{nreg}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nreg}}\ge 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}}$.
On entry, ${\mathbf{num}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{num}}\ge {\mathbf{nreg}}+{\mathbf{mn}}$.
${\mathbf{ifail}}=2$
On entry, ${\mathbf{lwork}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{lwork}}\ge \left({\mathbf{nreg}}+3\right)×{\mathbf{num}}+{\mathbf{npar}}+403$.
${\mathbf{ifail}}=3$
On entry, the matrix $X$ is not full rank.
${\mathbf{ifail}}=4$
The information matrix is not positive definite.
${\mathbf{ifail}}=5$
The maximum number of iterations has been reached.
${\mathbf{ifail}}=6$
The log-likelihood cannot be optimized any further.
${\mathbf{ifail}}=7$
No feasible model parameters could be found.
${\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

g13faf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g13faf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

None.

10Example

This example fits a $\text{GARCH}\left(1,1\right)$ model with Student's $t$-distributed residuals to some simulated data.
The process parameter estimates, $\stackrel{^}{\theta }$, are obtained using g13faf, and a four step ahead volatility estimate is computed using g13fbf.
The data was simulated using g05pdf.

10.1Program Text

Program Text (g13fafe.f90)

10.2Program Data

Program Data (g13fafe.d)

10.3Program Results

Program Results (g13fafe.r)