garch(model=var1,p=1,q=1,mv=dcc,variances=varma,method=bfgs,$
iters=1000,pmethod=simplex,piters=100,noprint) 250 *
garch(model=var1,p=1,q=1,mv=dcc,variances=varma,method=bfgs,iters=1000,$
initial=%beta,pmethod=simplex,piters=100,robusterrors,rvectors=rdcc,hmatrices=hdcc)
@regcrits
*
* Do the univariate diagnostics (serial correlation of standardized
* residuals and their squares) for each of the models.
*
procedure UniDiagnostics resids hmats
type series[vect] resids
type series[symm] hmats
*
option string title
option integer number 20
option vect[strings] labels
*
local integer i
*
disp
if %defined(title)
disp "Univariate Diagnostics for" title
disp
do i=1,%nvar
set stdu %regstart() %regend() = resids(t)(i)/sqrt(hmats(t)(i,i))
set stdusq = stdu^2
corr(number=number,noprint,qstats) stdu
if %defined(labels)
disp labels(i)
disp "Q(20)r" %qstat %signif
corr(number=number,noprint,qstats) stdusq
disp "Q(20)r^2" %qstat %signif
end do i
end
@UniDiagnostics(labels=labels,title="BEKK") rbekk hbekk
@UniDiagnostics(labels=labels,title="Diag") rdiag hdiag
@UniDiagnostics(labels=labels,title="CCC") rcc hcc
@UniDiagnostics(labels=labels,title="DCC") rdcc hdcc
*
* Compute the correlations from the multivariate GARCH
*
set rho12 = hcc(t)(1,2)/sqrt(hcc(t)(1,1)*hcc(t)(2,2))
set rho13 = hcc(t)(1,3)/sqrt(hcc(t)(1,1)*hcc(t)(3,3))
set rho23 = hcc(t)(2,3)/sqrt(hcc(t)(2,2)*hcc(t)(3,3))
*
* Get the overall minimum of the three variables, so the graphs can be
* on a comparable scale. Use 0 as the minimum if they're all positive.
*
table(noprint) / rho12 rho13 rho23
compute graphmin=%min(%minimum,0.0)
*
spgraph(vfields=3,hfields=2,footer="Fig 3. Time-varying conditional correlations from CCC model")
graph(header="Correlation of ice with sh",min=graphmin)
# rho12
spgraph(done)
graph(header="Correlation of ice with copper",min=graphmin)
# rho13
spgraph(done)
graph(header="Correlation of sh with copper",min=graphmin)
# rho23
spgraph(done)