PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_rand_times_garch_asym1 (g05pd)
Purpose
nag_rand_times_garch_asym1 (g05pd) generates a given number of terms of a type I
process (see
Engle and Ng (1993)).
Syntax
[
ht,
et,
r,
state,
ifail] = g05pd(
dist,
num,
ip,
iq,
theta,
gamma,
df,
fcall,
r,
state, 'lr',
lr)
[
ht,
et,
r,
state,
ifail] = nag_rand_times_garch_asym1(
dist,
num,
ip,
iq,
theta,
gamma,
df,
fcall,
r,
state, 'lr',
lr)
Description
A type I
process can be represented by:
where
or
. Here
is a standardized Student's
-distribution with
degrees of freedom and variance
,
is the number of observations in the sequence,
is the observed value of the
process at time
,
is the conditional variance at time
, and
the set of all information up to time
. 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_asym1 (g05pd).
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:
– string (length ≥ 1)
-
The type of distribution to use for
.
- A Normal distribution is used.
- A Student's -distribution is used.
Constraint:
or .
- 2:
– int64int32nag_int scalar
-
, the number of terms in the sequence.
Constraint:
.
- 3:
– int64int32nag_int scalar
-
The number of coefficients,
, for .
Constraint:
.
- 4:
– int64int32nag_int scalar
-
The number of coefficients,
, for .
Constraint:
.
- 5:
– double array
-
The first element must contain the coefficient
, the next
iq elements must contain the coefficients
, for
. The remaining
ip elements must contain the coefficients
, for
.
Constraints:
- ;
- , for .
- 6:
– double scalar
-
The asymmetry parameter for the sequence.
- 7:
– int64int32nag_int scalar
-
The number of degrees of freedom for the Student's
-distribution.
If
,
df is not referenced.
Constraint:
if , .
- 8:
– logical scalar
-
If
, a new sequence is to be generated, otherwise a given sequence is to be continued using the information in
r.
- 9:
– double array
-
The array contains information required to continue a sequence if .
- 10:
– 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:
– int64int32nag_int scalar
-
Default:
the dimension of the array
r.
The dimension of the array
r.
Constraint:
.
Output Parameters
- 1:
– double array
-
The conditional variances
, for , for the sequence.
- 2:
– double array
-
The observations
, for , for the sequence.
- 3:
– double array
-
Contains information that can be used in a subsequent call of nag_rand_times_garch_asym1 (g05pd), with .
- 4:
– int64int32nag_int array
-
Contains updated information on the state of the generator.
- 5:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry,
dist is not valid.
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
Constraint: .
-
-
ip or
iq is not the same as when
r was set up in a previous call.
-
-
On entry,
lr is not large enough,
: minimum length required .
-
-
On entry,
state vector has been corrupted or not initialized.
-
-
On entry, sum of , for is .
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
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_asym1 (g05pd) to generate two realizations, each consisting of ten observations, from a symmetric
model.
Open in the MATLAB editor:
g05pd_example
function g05pd_example
fprintf('g05pd example results\n\n');
seed = [int64(1762543)];
genid = int64(1);
subid = int64(1);
[state, ifail] = g05kf( ...
genid, subid, seed);
dist = 'N';
num = int64(10);
ip = int64(0);
iq = int64(3);
theta = [0.8; 0.6; 0.2; 0.1];
gamma = -0.4;
df = int64(0);
fcall = true;
r = zeros(2*(ip+iq+2),1);
[ht, et, r, state, ifail] = g05pd( ...
dist, num, ip, iq, theta, ...
gamma, df, fcall, r, state);
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
fcall = false;
[ht, et, r, state, ifail] = g05pd( ...
dist, num, ip, iq, theta, ...
gamma, df, fcall, r, state);
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
g05pd example results
Realisation Number 1
i ht(i) et(i)
--------------------------------------
1 0.9440 0.3389
2 0.8502 -1.1484
3 2.2553 0.9943
4 1.4918 1.0204
5 1.3413 -1.4544
6 2.9757 -0.0326
7 1.6386 -0.3767
8 1.5433 0.9892
9 1.1477 -0.0049
10 1.0281 0.4508
Realisation Number 2
i ht(i) et(i)
--------------------------------------
1 0.8691 -1.5286
2 3.0485 -1.1339
3 2.9558 0.5424
4 1.6547 -2.0734
5 4.7100 0.5153
6 2.0336 -0.8373
7 2.3331 -1.0912
8 2.4417 3.8999
9 8.7473 3.8171
10 10.4783 0.2480
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015