NAG FL Interface
g13faf (uni_​garch_​asym1_​estim)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Subroutine g13faf ( dist, yt, x, ldx, num, ip, iq, nreg, mn, isym, npar, theta, se, sc, covr, ldcovr, pht, et, ht, lgf, copts, maxit, tol, work, lwork, ifail)
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
C Header Interface
#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.

3 Description

A univariate regression-type I AGARCH(p,q) process, with q coefficients αi, for i=1,2,,q, p coefficients βi, for i=1,2,,p, and k linear regression coefficients bi, for i=1,2,,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 εtψt-1=N(0,ht) or εtψt-1=St(df,ht). Here St is a standardized Student's t-distribution with df degrees of freedom and variance ht, T is the number of terms in the sequence, yt denotes the endogenous variables, xt the exogenous variables, bo the regression mean, b the regression coefficients, εt the residuals, ht the conditional variance, df the number of degrees of freedom of the Student's t-distribution, and ψt the set of all information up to time t.
g13faf provides an estimate for θ^, the parameter vector θ=(bo,bT,ωT) where bT=(b1,,bk), ωT=(α0,α1,,αq,β1,,βp,γ) when dist='N' and ωT=(α0,α1,,αq,β1,,βp,γ,df) when dist='T'.
isym, mn and nreg can be used to simplify the GARCH(p,q) expression in (1) as follows:
No Regression and No Mean
No Regression
Note:  if the yt=μ+εt, where μ is known (not to be estimated by g13faf) then (1) can be written as ytμ=εt, where ytμ=yt-μ. This corresponds to the case No Regression and No Mean, with yt replaced by yt-μ.
No Mean

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

5 Arguments

1: dist Character(1) Input
On entry: the type of distribution to use for et.
dist='N'
A Normal distribution is used.
dist='T'
A Student's t-distribution is used.
Constraint: dist='N' or 'T'.
2: yt(num) Real (Kind=nag_wp) array Input
On entry: the sequence of observations, yt, for t=1,2,,T.
3: x(ldx,*) Real (Kind=nag_wp) array Input
Note: the second dimension of the array x must be at least nreg.
On entry: row t of x must contain the time dependent exogenous vector xt , where xtT = (xt1,,xtk) , for t=1,2,,T.
4: ldx Integer Input
On entry: the first dimension of the array x as declared in the (sub)program from which g13faf is called.
Constraint: ldxnum.
5: num Integer Input
On entry: T, the number of terms in the sequence.
Constraints:
  • nummax(ip,iq);
  • numnreg+mn.
6: ip Integer Input
On entry: the number of coefficients, βi, for i=1,2,,p.
Constraint: ip0 (see also npar).
7: iq Integer Input
On entry: the number of coefficients, αi, for i=1,2,,q.
Constraint: iq1 (see also npar).
8: nreg Integer Input
On entry: k, the number of regression coefficients.
Constraint: nreg0 (see also npar).
9: mn Integer Input
On entry: if mn=1, the mean term b0 will be included in the model.
Constraint: mn=0 or 1.
10: isym Integer Input
On entry: if isym=1, the asymmetry term γ will be included in the model.
Constraint: isym=0 or 1.
11: npar Integer Input
On entry: the number of parameters to be included in the model. npar=1+iq+ip+isym+mn+nreg when dist='N', and npar=2+iq+ip+isym+mn+nreg when dist='T'.
Constraint: npar<20.
12: theta(npar) Real (Kind=nag_wp) array Input/Output
On entry: the initial parameter estimates for the vector θ.
The first element must contain the coefficient αo and the next iq elements must contain the coefficients αi, for i=1,2,,q.
The next ip elements must contain the coefficients βj, for j=1,2,,p.
If isym=1, the next element must contain the asymmetry parameter γ.
If dist='T', the next element must contain df, the number of degrees of freedom of the Student's t-distribution.
If mn=1, the next element must contain the mean term bo.
If copts(2)=.FALSE., the remaining nreg elements are taken as initial estimates of the linear regression coefficients bi, for i=1,2,,k.
On exit: the estimated values θ^ for the vector θ.
The first element contains the coefficient αo, the next iq elements contain the coefficients αi, for i=1,2,,q.
The next ip elements are the coefficients βj, for j=1,2,,p.
If isym=1, the next element contains the estimate for the asymmetry parameter γ.
If dist='T', the next element contains an estimate for df, the number of degrees of freedom of the Student's t-distribution.
If mn=1, the next element contains an estimate for the mean term bo.
The final nreg elements are the estimated linear regression coefficients bi, for i=1,2,,k.
13: se(npar) Real (Kind=nag_wp) array Output
On exit: the standard errors for θ^.
The first element contains the standard error for αo. The next iq elements contain the standard errors for αi, for i=1,2,,q. The next ip elements are the standard errors for βj, for j=1,2,,p.
If isym=1, the next element contains the standard error for γ.
If dist='T', the next element contains the standard error for df, the number of degrees of freedom of the Student's t-distribution.
If mn=1, the next element contains the standard error for bo.
The final nreg elements are the standard errors for bj, for j=1,2,,k.
14: sc(npar) Real (Kind=nag_wp) array Output
On exit: the scores for θ^.
The first element contains the score for αo.
The next iq elements contain the score for αi, for i=1,2,,q.
The next ip elements are the scores for βj, for j=1,2,,p.
If isym=1, the next element contains the score for γ.
If dist='T', the next element contains the score for df, the number of degrees of freedom of the Student's t-distribution.
If mn=1, the next element contains the score for bo.
The final nreg elements are the scores for bj, for j=1,2,,k.
15: covr(ldcovr,npar) Real (Kind=nag_wp) array Output
On exit: the covariance matrix of the parameter estimates θ^, that is the inverse of the Fisher Information Matrix.
16: ldcovr Integer Input
On entry: the first dimension of the array covr as declared in the (sub)program from which g13faf is called.
Constraint: ldcovrnpar.
17: pht Real (Kind=nag_wp) Input/Output
On entry: if copts(2)=.FALSE., pht is the value to be used for the pre-observed conditional variance; otherwise pht is not referenced.
On exit: if copts(2)=.TRUE., pht is the estimated value of the pre-observed conditional variance.
18: et(num) Real (Kind=nag_wp) array Output
On exit: the estimated residuals, εt, for t=1,2,,T.
19: ht(num) Real (Kind=nag_wp) array Output
On exit: the estimated conditional variances, ht, for t=1,2,,T.
20: lgf Real (Kind=nag_wp) Output
On exit: the value of the log-likelihood function at θ^.
21: copts(2) Logical array Input
On entry: the options to be used by g13faf.
copts(1)=.TRUE.
Stationary conditions are enforced, otherwise they are not.
copts(2)=.TRUE.
The routine provides initial parameter estimates of the regression terms, otherwise these are to be provided by you.
22: maxit Integer Input
On entry: the maximum number of iterations to be used by the optimization routine when estimating the GARCH(p,q) parameters. If maxit is set to 0, the standard errors, score vector and variance-covariance are calculated for the input value of θ in theta when dist='N'; however the value of θ is not updated.
Constraint: maxit0.
23: tol Real (Kind=nag_wp) Input
On entry: the tolerance to be used by the optimization routine when estimating the GARCH(p,q) parameters.
24: work(lwork) Real (Kind=nag_wp) array Workspace
25: lwork Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which g13faf is called.
Constraint: lwork(nreg+3)×num+npar+403.
26: 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 ifail0 on exit. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry 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.
ifail=1
On entry, dist=value.
Constraint: dist='N' or 'T'.
On entry, ip=value.
Constraint: ip0.
On entry, iq=value.
Constraint: iq1.
On entry, isym=value.
Constraint: isym=0 or 1.
On entry, ldcovr=value.
Constraint: ldcovrnpar.
On entry, ldx=value.
Constraint: ldxnum.
On entry, maxit=value.
Constraint: maxit0.
On entry, mn=value.
Constraint: mn=0 or 1.
On entry, npar=value.
Constraint: if dist='N' then npar=1+iq+ip+isym+mn+nreg, else npar=2+iq+ip+isym+mn+nreg.
On entry, npar=value.
Constraint: npar<20.
On entry, nreg=value.
Constraint: nreg0.
On entry, num=value.
Constraint: max(ip,iq)num.
On entry, num=value.
Constraint: numnreg+mn.
ifail=2
On entry, lwork=value.
Constraint: lwork(nreg+3)×num+npar+403.
ifail=3
On entry, the matrix X is not full rank.
ifail=4
The information matrix is not positive definite.
ifail=5
The maximum number of iterations has been reached.
ifail=6
The log-likelihood cannot be optimized any further.
ifail=7
No feasible model parameters could be found.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism 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.

9 Further Comments

None.

10 Example

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

10.1 Program Text

Program Text (g13fafe.f90)

10.2 Program Data

Program Data (g13fafe.d)

10.3 Program Results

Program Results (g13fafe.r)