*
* @MVGARCHVarFore computes out-of-sample variance forecasts for several
* types of GARCH models which don't have a full VECH representation. As
* a result, they forecast only the variances (producing zeros for the
* off-diagonals). This can be used for MV=CC or MV=DCC with
* VARIANCES=SIMPLE, SPILLOVER or VARMA. It can't be used for
* VARIANCES=EXP or VARIANCES=KOUTMOS as those don't have simple
* extrapolations for the variance.
*
* @MVGARCHVarFore(options) h u
*
* Parameters:
* h (input and output) is the SERIES[SYMM] which has the in-sample
* estimates of the covariances (produced with the HMATRICES option
* on GARCH), and will be extended to hold the forecasts of the
* covariances (with zeros in the off-diagonals).
* u (input) is the SERIES[VECT] of the residuals. This is produced by
* the RVECTORS option on GARCH.
*
* This pulls the matrices for a variance recursion out of the output
* from the GARCH model. Do this immediately after the GARCH instruction
* and repeat the VARIANCES option.
*
* Options:
* VARIANCES=[SIMPLE]/VARMA/EXPONENTIAL/SPILLOVER/KOUTMOS
* (note that EXPONENTIAL and KOUTMOS are provided merely to give an
* informative error message. They don't admit a simple recursive formula
* for the variance).
* STEPS=number of out-of-sample forecast steps
* ASYMMETRIC/[NOASYMMETRIC]
*
* For GARCH(1,1) models with CC or DCC, and VARIANCES=SIMPLE, VARMA or
* SPILLOVER, the variances themselves (not the covariances) can be
* extrapolated using a matrix recursion:
*
* var(t) = C + A eps(t-1).^2 + B var(t-1)
*
* where var(t) is the n-vector of variances, C is an n-vector, A and B
* are n x n matrices, and eps(t-1).^2 is the vector of squares of
* residuals (.^2 meaning the elementwise squares). With
* VARIANCES=SIMPLE, A and B are diagonal, for VARIANCES=SPILLOVER, A is
* a full n x n matrix and B is diagonal, and for VARIANCES=VARMA, both A
* and B are full matrices.
*
procedure MVGARCHVarFore h u
type series[symm] *h
type series[vect] u
*
option choice variances 1 simple varma exponential spillover koutmos
option switch asymmetric 0
option integer steps 12
*
dec vect %%var_c
dec rect %%var_a %%var_b %%var_d
local series[symm] uu uus
*
if .not.%defined(h).or..not.%defined(u) {
disp "Usage: @MVGARCHVarFore(options) H_Matrices U_Vectors"
return
}
if variances==3.or.variances==5 {
disp "@MVGARCHVarFore doesn't apply to exponential or Koutmos variances"
return
}
*
* Get the matrices in the variance recursion
*
@MVGARCHVarMats(variances=variances)
*
* Set UU and UUS (the latter is the asymmetric squares) for the actual data
*
gset uu %regstart() %regend() = %outerxx(u)
gset uus %regstart() %regend() = %outerxx(%minus(u))
gset uu %regend()+1 %regend()+steps = %zeros(%nvar,%nvar)
gset uus %regend()+1 %regend()+steps = %zeros(%nvar,%nvar)
*
* Out of sample, the asymmetric term is just .5 times the variance.
*
gset h %regend()+1 %regend()+steps = $
uu=%diag(%%var_c+%%var_a*%xdiag(uu{1})+%%var_b*%xdiag(h{1})+%%var_d*%xdiag(uus{1})),$
uus=.5*uu,uu
end