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_tsa_uni_garch_asym1_forecast (g13fb)

Purpose

nag_tsa_uni_garch_asym1_forecast (g13fb) forecasts the conditional variances htht, for t = T + 1,,T + ξt=T+1,,T+ξ, from a type I AGARCH(p,q)AGARCH(p,q) sequence, where ξξ is the forecast horizon and TT is the current time (see Engle and Ng (1993)).

Syntax

[fht, ifail] = g13fb(nt, ip, iq, theta, gamma, ht, et, 'num', num)
[fht, ifail] = nag_tsa_uni_garch_asym1_forecast(nt, ip, iq, theta, gamma, ht, et, 'num', num)

Description

Assume the GARCH(p,q)GARCH(p,q) process can be represented by:
q p
ht = α0 + αi(εti + γ)2 + βihti,  t = 1,2,,T
i = 1 i = 1
ht=α0+i=1qαi (εt-i+γ) 2+i=1pβiht-i,  t=1,2,,T
where εtψt1 = N(0,ht)εtψt-1=N(0,ht) or εtψt1 = St(df,ht)εtψt-1=St(df,ht), has been modelled by nag_tsa_uni_garch_asym1_estim (g13fa) and the estimated conditional variances and residuals are contained in the arrays ht and et respectively.
nag_tsa_uni_garch_asym1_forecast (g13fb) will then use the last max (p,q)max(p,q) elements of the arrays ht and et to estimate the conditional variance forecasts, htψThtψT, where t = T + 1,,T + ξt=T+1,,T+ξ and ξξ is the forecast horizon.

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:     nt – int64int32nag_int scalar
ξξ, the forecast horizon.
Constraint: nt > 0nt>0.
2:     ip – int64int32nag_int scalar
The number of coefficients, βiβi, for i = 1,2,,pi=1,2,,p.
Constraints:
  • max (ip,iq)20max(ip,iq)20;
  • ip0ip0.
3:     iq – int64int32nag_int scalar
The number of coefficients, αiαi, for i = 1,2,,qi=1,2,,q.
Constraints:
  • max (ip,iq)20max(ip,iq)20;
  • iq1iq1.
4:     theta(iq + ip + 1iq+ip+1) – double array
The first element must contain the coefficient αoαo and the next iq elements must contain the coefficients αiαi, for i = 1,2,,qi=1,2,,q. The remaining ip elements must contain the coefficients βjβj, for j = 1,2,,pj=1,2,,p.
5:     gamma – double scalar
The asymmetry parameter γγ for the GARCH(p,q)GARCH(p,q) sequence.
6:     ht(num) – double array
num, the dimension of the array, must satisfy the constraint max (ip,iq)nummax(ip,iq)num.
The sequence of past conditional variances for the GARCH(p,q)GARCH(p,q) process, htht, for t = 1,2,,Tt=1,2,,T.
7:     et(num) – double array
num, the dimension of the array, must satisfy the constraint max (ip,iq)nummax(ip,iq)num.
The sequence of past residuals for the GARCH(p,q)GARCH(p,q) process, εtεt, for t = 1,2,,Tt=1,2,,T.

Optional Input Parameters

1:     num – int64int32nag_int scalar
Default: The dimension of the arrays ht, et. (An error is raised if these dimensions are not equal.)
The number of terms in the arrays ht and et from the modelled sequence.
Constraint: max (ip,iq)nummax(ip,iq)num.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     fht(nt) – double array
The forecast values of the conditional variance, htht, for t = T + 1,,T + ξt=T+1,,T+ξ.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,num < max (ip,iq)num<max(ip,iq),
oriq < 1iq<1,
orip < 0ip<0,
ormax (ip,iq) > 20max(ip,iq)>20,
ornt0nt0.

Accuracy

Not applicable.

Further Comments

None.

Example

function nag_tsa_uni_garch_asym1_forecast_example
num  = 100;
mn   = 1;
nreg = 2;

% Series
yt = [ 9.04;  9.49;  9.12;  9.23;  9.35;
       9.09;  9.75;  9.23;  8.76;  9.17;
       9.20;  9.64;  8.74;  9.23;  9.42;
       9.70;  9.55; 10.00;  9.18;  9.77;
       9.80;  9.56;  9.28;  9.68;  9.51;
       9.51;  8.97;  9.30;  9.52;  9.41;
       9.53;  9.75;  9.72;  9.38;  9.28;
       9.42;  9.74;  9.75;  9.60;  9.90;
       9.06;  9.92;  9.21;  9.57;  9.42;
       8.65;  8.85;  9.61; 10.77; 10.19;
      10.47; 10.10; 10.21;  9.96;  9.66;
       9.79; 10.30;  9.68; 10.08; 10.38;
       9.69;  9.02;  9.89; 10.46; 10.47;
       9.99;  9.76;  9.78;  9.62; 10.43;
      10.42;  9.95;  9.95;  9.70; 10.24;
       9.78;  9.98;  8.73; 10.23;  9.10;
      10.27;  9.85; 10.44; 10.30; 10.08;
      10.20; 10.14;  9.89;  9.90; 11.33;
       9.71;  9.40;  9.97; 10.92;  9.76;
      10.16; 10.43;  9.60; 10.29; 10.03];

% Exogenous variables
x = zeros(num, nreg+mn);
x(:, 1:nreg) = [0.12, 2.40; 0.12, 2.40; 0.13, 2.40; 0.14, 2.40; 0.14, 2.40;
                0.15, 2.40; 0.16, 2.40; 0.16, 2.40; 0.17, 2.40; 0.18, 2.41;
                0.19, 2.41; 0.19, 2.41; 0.20, 2.41; 0.21, 2.41; 0.21, 2.41;
                0.22, 2.41; 0.23, 2.41; 0.23, 2.41; 0.24, 2.41; 0.25, 2.42;
                0.25, 2.42; 0.26, 2.42; 0.26, 2.42; 0.27, 2.42; 0.28, 2.42;
                0.28, 2.42; 0.29, 2.42; 0.30, 2.42; 0.30, 2.42; 0.31, 2.43;
                0.32, 2.43; 0.32, 2.43; 0.33, 2.43; 0.33, 2.43; 0.34, 2.43;
                0.35, 2.43; 0.35, 2.43; 0.36, 2.43; 0.37, 2.43; 0.37, 2.44;
                0.38, 2.44; 0.38, 2.44; 0.39, 2.44; 0.39, 2.44; 0.40, 2.44;
                0.41, 2.44; 0.41, 2.44; 0.42, 2.44; 0.42, 2.44; 0.43, 2.45;
                0.43, 2.45; 0.44, 2.45; 0.45, 2.45; 0.45, 2.45; 0.46, 2.45;
                0.46, 2.45; 0.47, 2.45; 0.47, 2.45; 0.48, 2.45; 0.48, 2.46;
                0.49, 2.46; 0.49, 2.46; 0.50, 2.46; 0.50, 2.46; 0.51, 2.46;
                0.51, 2.46; 0.52, 2.46; 0.52, 2.46; 0.53, 2.46; 0.53, 2.47;
                0.54, 2.47; 0.54, 2.47; 0.54, 2.47; 0.55, 2.47; 0.55, 2.47;
                0.56, 2.47; 0.56, 2.47; 0.57, 2.47; 0.57, 2.47; 0.57, 2.48;
                0.58, 2.48; 0.58, 2.48; 0.59, 2.48; 0.59, 2.48; 0.59, 2.48;
                0.60, 2.48; 0.60, 2.48; 0.61, 2.48; 0.61, 2.48; 0.61, 2.49;
                0.62, 2.49; 0.62, 2.49; 0.62, 2.49; 0.63, 2.49; 0.63, 2.49;
                0.63, 2.49; 0.64, 2.49; 0.64, 2.49; 0.64, 2.49; 0.64, 2.50];

% Details of model to fit
dist = 't';
ip = 1;
iq = 1;
isym = 1;

% Control parameters
copts = [true; true];
maxit = int64(200);
tol = 0.00001;

% Initial values
gammaval = -0.1;
theta = [0.05; 0.1; 0.15; gammaval; 2.6; 1.5; 0; 0];

% Forecast horizon
nt = 4;


% Fit the GARCH model
[theta, se, sc, covar, hp, et, ht, lgf, ifail] = ...
    nag_tsa_uni_garch_asym1_estim(dist, yt, x, int64(ip), int64(iq), int64(nreg), ...
                                  int64(mn), int64(isym), theta, 0, copts, maxit, tol);

% Calculate the volatility forecast
[fht, ifail] = ...
    nag_tsa_uni_garch_asym1_forecast(int64(nt), int64(ip), int64(iq), ...
                                     theta, gammaval, ht, et);

% Output the results
fprintf('\n               Parameter        Standard\n');
fprintf('               estimates         errors\n');

% Output the coefficient alpha_0
fprintf('Alpha0 %16.2f%16.2f\n', theta(1), se(1));
l = 2;

% Output the coefficients alpha_i
for i = l:l+iq-1
  fprintf('Alpha%d %16.2f%16.2f\n', i-1, theta(i), se(i));
end
l = l+iq;

% Output the coefficients beta_j
fprintf('\n');
for i = l:l+ip-1
  fprintf(' Beta%d %16.2f%16.2f\n', i-l+1, theta(i), se(i));
end
l = l+ip;

% Output the estimated asymmetry parameter, gamma
if (isym == 1)
  fprintf('\n Gamma %16.2f%16.2f\n', theta(l), se(l));
  l = l+1;
end
% Output the estimated degrees of freedom, df
if (dist == 't')
  fprintf('\n    DF %16.2f%16.2f\n', theta(l), se(l));
  l = l + 1;
end

% Output the estimated mean term, b_0
if (mn == 1)
  fprintf('\n    B0 %16.2f%16.2f\n', theta(l), se(l));
  l = l + 1;
end

% Output the estimated linear regression coefficients, b_i
for i = l:l+nreg-1
  fprintf('    B%d %16.2f%16.2f\n', i-l+1, theta(i), se(i));
end

% Display the volatility forecast
fprintf('\nVolatility forecast = %12.4f\n', fht(nt));
 

               Parameter        Standard
               estimates         errors
Alpha0             0.00            0.06
Alpha1             0.11            0.13

 Beta1             0.66            0.23

 Gamma            -0.62            0.62

    DF             6.25            4.70

    B0             3.85           24.11
    B1             1.48            1.82
    B2             2.15           10.16

Volatility forecast =       0.0626

function g13fb_example
num  = 100;
mn   = 1;
nreg = 2;

% Series
yt = [ 9.04;  9.49;  9.12;  9.23;  9.35;
       9.09;  9.75;  9.23;  8.76;  9.17;
       9.20;  9.64;  8.74;  9.23;  9.42;
       9.70;  9.55; 10.00;  9.18;  9.77;
       9.80;  9.56;  9.28;  9.68;  9.51;
       9.51;  8.97;  9.30;  9.52;  9.41;
       9.53;  9.75;  9.72;  9.38;  9.28;
       9.42;  9.74;  9.75;  9.60;  9.90;
       9.06;  9.92;  9.21;  9.57;  9.42;
       8.65;  8.85;  9.61; 10.77; 10.19;
      10.47; 10.10; 10.21;  9.96;  9.66;
       9.79; 10.30;  9.68; 10.08; 10.38;
       9.69;  9.02;  9.89; 10.46; 10.47;
       9.99;  9.76;  9.78;  9.62; 10.43;
      10.42;  9.95;  9.95;  9.70; 10.24;
       9.78;  9.98;  8.73; 10.23;  9.10;
      10.27;  9.85; 10.44; 10.30; 10.08;
      10.20; 10.14;  9.89;  9.90; 11.33;
       9.71;  9.40;  9.97; 10.92;  9.76;
      10.16; 10.43;  9.60; 10.29; 10.03];

% Exogenous variables
x = zeros(num, nreg+mn);
x(:, 1:nreg) = [0.12, 2.40; 0.12, 2.40; 0.13, 2.40; 0.14, 2.40; 0.14, 2.40;
                0.15, 2.40; 0.16, 2.40; 0.16, 2.40; 0.17, 2.40; 0.18, 2.41;
                0.19, 2.41; 0.19, 2.41; 0.20, 2.41; 0.21, 2.41; 0.21, 2.41;
                0.22, 2.41; 0.23, 2.41; 0.23, 2.41; 0.24, 2.41; 0.25, 2.42;
                0.25, 2.42; 0.26, 2.42; 0.26, 2.42; 0.27, 2.42; 0.28, 2.42;
                0.28, 2.42; 0.29, 2.42; 0.30, 2.42; 0.30, 2.42; 0.31, 2.43;
                0.32, 2.43; 0.32, 2.43; 0.33, 2.43; 0.33, 2.43; 0.34, 2.43;
                0.35, 2.43; 0.35, 2.43; 0.36, 2.43; 0.37, 2.43; 0.37, 2.44;
                0.38, 2.44; 0.38, 2.44; 0.39, 2.44; 0.39, 2.44; 0.40, 2.44;
                0.41, 2.44; 0.41, 2.44; 0.42, 2.44; 0.42, 2.44; 0.43, 2.45;
                0.43, 2.45; 0.44, 2.45; 0.45, 2.45; 0.45, 2.45; 0.46, 2.45;
                0.46, 2.45; 0.47, 2.45; 0.47, 2.45; 0.48, 2.45; 0.48, 2.46;
                0.49, 2.46; 0.49, 2.46; 0.50, 2.46; 0.50, 2.46; 0.51, 2.46;
                0.51, 2.46; 0.52, 2.46; 0.52, 2.46; 0.53, 2.46; 0.53, 2.47;
                0.54, 2.47; 0.54, 2.47; 0.54, 2.47; 0.55, 2.47; 0.55, 2.47;
                0.56, 2.47; 0.56, 2.47; 0.57, 2.47; 0.57, 2.47; 0.57, 2.48;
                0.58, 2.48; 0.58, 2.48; 0.59, 2.48; 0.59, 2.48; 0.59, 2.48;
                0.60, 2.48; 0.60, 2.48; 0.61, 2.48; 0.61, 2.48; 0.61, 2.49;
                0.62, 2.49; 0.62, 2.49; 0.62, 2.49; 0.63, 2.49; 0.63, 2.49;
                0.63, 2.49; 0.64, 2.49; 0.64, 2.49; 0.64, 2.49; 0.64, 2.50];

% Details of model to fit
dist = 't';
ip = 1;
iq = 1;
isym = 1;

% Control parameters
copts = [true; true];
maxit = int64(200);
tol = 0.00001;

% Initial values
gammaval = -0.1;
theta = [0.05; 0.1; 0.15; gammaval; 2.6; 1.5; 0; 0];

% Forecast horizon
nt = 4;


% Fit the GARCH model
[theta, se, sc, covar, hp, et, ht, lgf, ifail] = ...
    g13fa(dist, yt, x, int64(ip), int64(iq), int64(nreg), int64(mn), int64(isym), ...
          theta, 0, copts, maxit, tol);

% Calculate the volatility forecast
[fht, ifail] = g13fb(int64(nt), int64(ip), int64(iq), theta, gammaval, ht, et);

% Output the results
fprintf('\n               Parameter        Standard\n');
fprintf('               estimates         errors\n');

% Output the coefficient alpha_0
fprintf('Alpha0 %16.2f%16.2f\n', theta(1), se(1));
l = 2;

% Output the coefficients alpha_i
for i = l:l+iq-1
  fprintf('Alpha%d %16.2f%16.2f\n', i-1, theta(i), se(i));
end
l = l+iq;

% Output the coefficients beta_j
fprintf('\n');
for i = l:l+ip-1
  fprintf(' Beta%d %16.2f%16.2f\n', i-l+1, theta(i), se(i));
end
l = l+ip;

% Output the estimated asymmetry parameter, gamma
if (isym == 1)
  fprintf('\n Gamma %16.2f%16.2f\n', theta(l), se(l));
  l = l+1;
end
% Output the estimated degrees of freedom, df
if (dist == 't')
  fprintf('\n    DF %16.2f%16.2f\n', theta(l), se(l));
  l = l + 1;
end

% Output the estimated mean term, b_0
if (mn == 1)
  fprintf('\n    B0 %16.2f%16.2f\n', theta(l), se(l));
  l = l + 1;
end

% Output the estimated linear regression coefficients, b_i
for i = l:l+nreg-1
  fprintf('    B%d %16.2f%16.2f\n', i-l+1, theta(i), se(i));
end

% Display the volatility forecast
fprintf('\nVolatility forecast = %12.4f\n', fht(nt));
 

               Parameter        Standard
               estimates         errors
Alpha0             0.00            0.06
Alpha1             0.11            0.13

 Beta1             0.66            0.23

 Gamma            -0.62            0.62

    DF             6.25            4.70

    B0             3.85           24.11
    B1             1.48            1.82
    B2             2.15           10.16

Volatility forecast =       0.0626


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–2013