hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_rand_times_garch_asym2 (g05pe)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_rand_times_garch_asym2 (g05pe) generates a given number of terms of a type II AGARCHp,q process (see Engle and Ng (1993)).

Syntax

[ht, et, r, state, ifail] = g05pe(dist, num, ip, iq, theta, gamma, df, fcall, r, state, 'lr', lr)
[ht, et, r, state, ifail] = nag_rand_times_garch_asym2(dist, num, ip, iq, theta, gamma, df, fcall, r, state, 'lr', lr)

Description

A type II AGARCHp,q process can be represented by:
ht = α0 + i=1 q αi εt-i+γεt-i 2 + i=1 p βi ht-i ,   t=1,2,,T ;  
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 observations in the sequence, εt is the observed value of the GARCHp,q process at time t, ht is the conditional variance at time t, and ψt the set of all information up to time t. Symmetric GARCH sequences are generated when γ is zero, otherwise asymmetric GARCH sequences are generated with γ specifying the amount by which positive (or negative) shocks are to be enhanced.
One of the initialization functions nag_rand_init_repeat (g05kf) (for a repeatable sequence if computed sequentially) or nag_rand_init_nonrepeat (g05kg) (for a non-repeatable sequence) must be called prior to the first call to nag_rand_times_garch_asym2 (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

Parameters

Compulsory Input Parameters

1:     dist – string (length ≥ 1)
The type of distribution to use for εt.
dist='N'
A Normal distribution is used.
dist='T'
A Student's t-distribution is used.
Constraint: dist='N' or 'T'.
2:     num int64int32nag_int scalar
T, the number of terms in the sequence.
Constraint: num0.
3:     ip int64int32nag_int scalar
The number of coefficients, βi, for i=1,2,,p.
Constraint: ip0.
4:     iq int64int32nag_int scalar
The number of coefficients, αi, for i=1,2,,q.
Constraint: iq1.
5:     thetaiq+ip+1 – double array
The first element must contain the coefficient αo, the next iq elements must contain the coefficients αi, for i=1,2,,q. The remaining ip elements must contain the coefficients βj, for j=1,2,,p.
Constraints:
  • i=2 iq+ip+1 thetai<1.0;
  • thetai0.0, for i=2,3,,ip+iq+1.
6:     gamma – double scalar
The asymmetry parameter γ for the GARCHp,q sequence.
7:     df int64int32nag_int scalar
The number of degrees of freedom for the Student's t-distribution.
If dist='N', df is not referenced.
Constraint: if dist='T', df>2.
8:     fcall – logical scalar
If fcall=true, a new sequence is to be generated, otherwise a given sequence is to be continued using the information in r.
9:     rlr – double array
The array contains information required to continue a sequence if fcall=false.
10:   state: int64int32nag_int array
Note: the actual argument supplied must be the array state supplied to the initialization routines nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).
Contains information on the selected base generator and its current state.

Optional Input Parameters

1:     lr int64int32nag_int scalar
Default: the dimension of the array r.
The dimension of the array r.
Constraint: lr2×ip+iq+2.

Output Parameters

1:     htnum – double array
The conditional variances ht, for t=1,2,,T, for the GARCHp,q sequence.
2:     etnum – double array
The observations εt, for t=1,2,,T, for the GARCHp,q sequence.
3:     rlr – double array
Contains information that can be used in a subsequent call of nag_rand_times_garch_asym2 (g05pe), with fcall=false.
4:     state: int64int32nag_int array
Contains updated information on the state of the generator.
5:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry, dist is not valid.
   ifail=2
Constraint: num0.
   ifail=3
Constraint: ip0.
   ifail=4
Constraint: iq1.
   ifail=5
Constraint: thetai0.0.
   ifail=7
Constraint: df3.
   ifail=11
ip or iq is not the same as when r was set up in a previous call.
   ifail=12
On entry, lr is not large enough, lr=_: minimum length required .
   ifail=13
On entry, state vector has been corrupted or not initialized.
   ifail=51
On entry, sum of thetai, for i=2,3,,ip+iq+1 is 1.0.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Not applicable.

Further Comments

None.

Example

This example first calls nag_rand_init_repeat (g05kf) to initialize a base generator then calls nag_rand_times_garch_asym2 (g05pe) to generate two realizations, each consisting of ten observations, from an asymmetric GARCH1,1 model.
function g05pe_example


fprintf('g05pe example results\n\n');

% Initialize the generator to a repeatable sequence
seed  = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
                        genid, subid, seed);

% Input parameters
dist  = 'N';
num   = int64(10);
ip    = int64(1);
iq    = int64(1);
theta = [0.08; 0.2; 0.7];
gamma = -0.4;
df    = int64(0);
fcall = true;
r     = zeros(2*(ip+iq+2),1);

% Generate the first realisation
[ht, et, r, state, ifail] = ...
  g05pe( ...
         dist, num, ip, iq, theta, gamma, df, fcall, r, state);

% Display the results
fprintf('\n Realisation Number 1\n');
fprintf('   i            ht(i)            et(i)\n');
fprintf('  --------------------------------------\n');
for i=1:num
  fprintf('  %2d  %16.4f %16.4f\n', i, ht(i), et(i));
end

% Generate a second realisation
fcall = false;
[ht, et, r, state, ifail] = ...
  g05pe( ...
         dist, num, ip, iq, theta, gamma, df, fcall, r, state);

% Display the results
fprintf('\n Realisation Number 2\n');
fprintf('   i            ht(i)            et(i)\n');
fprintf('  --------------------------------------\n');
for i=1:num
  fprintf('  %2d  %16.4f %16.4f\n', i, ht(i), et(i));
end


g05pe example results


 Realisation Number 1
   i            ht(i)            et(i)
  --------------------------------------
   1            0.6400           0.2790
   2            0.5336          -0.9098
   3            0.7780           0.5840
   4            0.6491           0.6731
   5            0.5670          -0.9456
   6            0.8275          -0.0172
   7            0.6593          -0.2390
   8            0.5639           0.5980
   9            0.5005          -0.0032
  10            0.4303           0.2917

 Realisation Number 2
   i            ht(i)            et(i)
  --------------------------------------
   1            0.3874          -1.0205
   2            0.7594          -0.5659
   3            0.7371           0.2709
   4            0.6013          -1.2499
   5            1.1133           0.2505
   6            0.8638          -0.5457
   7            0.8014          -0.6395
   8            0.8013           2.2341
   9            1.0003           1.2908
  10            0.9002           0.0727

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015