|
Examples / GARCHMVMAX.RPF |
GARCHMVMAX.RPF is an example of estimation of a multivariate GARCH model using MAXIMIZE (for model types that can't be done with GARCH). This is described in detailed in "MV GARCH Extensions".
Full Program
open data g10xrate.xls
data(format=xls,org=columns) 1 6237 usxjpn usxfra usxsui
*
set xjpn = 100.0*log(usxjpn/usxjpn{1})
set xfra = 100.0*log(usxfra/usxfra{1})
set xsui = 100.0*log(usxsui/usxsui{1})
*
* Estimation using MAXIMIZE
* The initial few lines of this set the estimation range, which needs to
* be done explicitly, and the number of variables. Then, vectors for the
* dependent variables, residuals and residuals formulas are set up. The
* SET instructions copy the dependent variables over into the slots in
* the vector of series.
*
compute gstart=2,gend=6237
compute n=3
dec vect[series] y(n) u(n)
dec vect[frml] resid(n)
set y(1) = xjpn
set y(2) = xfra
set y(3) = xsui
*
* This is specific to a mean-only model. It sets up the formulas (the &i
* are needed in the formula definitions when the FRML is defined in a
* loop), and estimates them using NLSYSTEM. This both initializes the
* mean parameters, and computes the unconditional covariance matrix. If
* you want more general mean equations, the simplest way to do that
* would be to define each FRML separately.
*
dec vect mu(n)
nonlin(parmset=meanparms) mu
do i=1,n
frml resid(i) = (y(&i)-mu(&i))
stats y(i)
compute mu(i)=%mean
end do i
nlsystem(parmset=meanparms,resids=u) gstart gend resid
compute rr=%sigma
*
* The paths of the covariance matrices and uu' are saved in the
* SERIES[SYMM] names H and UU. UX and HX are used to pull in residuals
* and H matrices.
*
declare series[symm] h uu
*
* ux is used when extracting a u vector
*
declare symm hx(n,n)
declare vect ux(n)
*
* These are used to initialize pre-sample variances.
*
gset h * gend = rr
gset uu * gend = rr
*
* This is a standard (normal) log likelihood formula for any
* multivariate GARCH model. The difference among these will be in the
* definitions of HF and RESID. The function %XT pulls information out of
* a matrix of SERIES.
*
declare frml[symm] hf
*
frml logl = $
hx = hf(t) , $
%do(i,1,n,u(i)=resid(i)) , $
ux = %xt(u,t), $
h(t)=hx, uu(t)=%outerxx(ux), $
%logdensity(hx,ux)
*****************************************************
*
* Standard GARCH(1,1)
*
dec symm vcs(n,n) vas(n,n) vbs(n,n)
compute vcs=rr*(1-.05-.80),vas=%const(0.05),vbs=%const(0.80)
nonlin(parmset=garchparms) vcs vas vbs
frml hf = vcs+vas.*uu{1}+vbs.*h{1}
maximize(parmset=meanparms+garchparms,pmethod=simplex,piters=10,$
iters=400) logl gstart gend
*****************************************************
*
* CC
* The correlations are parameterized using an (n-1)x(n-1) matrix for the
* subdiagonal. The (i,j) element of this will actually be the
* correlation between i+1 and j.
*
dec symm qc(n-1,n-1)
dec vect vcv(n) vav(n) vbv(n)
*
function hfcccgarch time
type symm hfcccgarch
type integer time
do i=1,n
compute hx(i,i)=vcv(i)+$
vbv(i)*h(time-1)(i,i)+vav(i)*uu(time-1)(i,i)
end do i
compute hfcccgarch=%corrtocv(qc,%xdiag(hx))
end
*
frml hf = hfcccgarch(t)
nonlin(parmset=garchparms) vcv vav vbv qc
compute vcv=%xdiag(rr*(1-.05-.80)),vav=%const(0.05),$
vbv=%const(0.80),qc=%const(0.0)
maximize(parmset=meanparms+garchparms,pmethod=simplex,piters=10) $
logl gstart gend
Output
Statistics on Series Y(1)
Observations 6236
Sample Mean 0.014351 Variance 0.398893
Standard Error 0.631580 SE of Sample Mean 0.007998
t-Statistic (Mean=0) 1.794334 Signif Level (Mean=0) 0.072808
Skewness 0.784016 Signif Level (Sk=0) 0.000000
Kurtosis (excess) 13.265486 Signif Level (Ku=0) 0.000000
Jarque-Bera 46362.538224 Signif Level (JB=0) 0.000000
Statistics on Series Y(2)
Observations 6236
Sample Mean -0.001885 Variance 0.426428
Standard Error 0.653015 SE of Sample Mean 0.008269
t-Statistic (Mean=0) -0.227972 Signif Level (Mean=0) 0.819675
Skewness -0.073929 Signif Level (Sk=0) 0.017182
Kurtosis (excess) 6.554159 Signif Level (Ku=0) 0.000000
Jarque-Bera 11167.339771 Signif Level (JB=0) 0.000000
Statistics on Series Y(3)
Observations 6236
Sample Mean 0.015834 Variance 0.587975
Standard Error 0.766795 SE of Sample Mean 0.009710
t-Statistic (Mean=0) 1.630665 Signif Level (Mean=0) 0.103012
Skewness -0.014788 Signif Level (Sk=0) 0.633634
Kurtosis (excess) 3.447021 Signif Level (Ku=0) 0.000000
Jarque-Bera 3087.554594 Signif Level (JB=0) 0.000000
Non-Linear System Estimation
Convergence in 4 Iterations. Final criterion was 0.0000000 <= 0.0000100
Usable Observations 6236
Log Likelihood -14518.1757
Standard Error of Estimate 0.6315293032
Sum of Squared Residuals 2487.0992707
Durbin-Watson Statistic 1.9120
Standard Error of Estimate 0.6529622576
Sum of Squared Residuals 2658.7791504
Durbin-Watson Statistic 1.9313
Standard Error of Estimate 0.7667335311
Sum of Squared Residuals 3666.0215993
Durbin-Watson Statistic 1.9271
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. MU(1) 0.014350879 0.007997246 1.79448 0.07273698
2. MU(2) -0.001885176 0.008268658 -0.22799 0.81965356
3. MU(3) 0.015834012 0.009709378 1.63080 0.10293343
MAXIMIZE - Estimation by BFGS
Convergence in 94 Iterations. Final criterion was 0.0000000 <= 0.0000100
Usable Observations 6236
Function Value -11835.6553
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. MU(1) 0.004645759 0.006713523 0.69200 0.48893720
2. MU(2) -0.003489248 0.006478797 -0.53856 0.59018757
3. MU(3) -0.002354764 0.007610826 -0.30940 0.75701981
4. VCS(1,1) 0.009018591 0.001215970 7.41679 0.00000000
5. VCS(2,1) 0.005698278 0.000759998 7.49776 0.00000000
6. VCS(2,2) 0.011511699 0.001388933 8.28816 0.00000000
7. VCS(3,1) 0.006015431 0.000794083 7.57532 0.00000000
8. VCS(3,2) 0.009938182 0.001266596 7.84637 0.00000000
9. VCS(3,3) 0.012774291 0.001612142 7.92380 0.00000000
10. VAS(1,1) 0.105849650 0.007721223 13.70892 0.00000000
11. VAS(2,1) 0.093970112 0.006254861 15.02353 0.00000000
12. VAS(2,2) 0.128202766 0.007396975 17.33178 0.00000000
13. VAS(3,1) 0.088843871 0.005550942 16.00519 0.00000000
14. VAS(3,2) 0.113665791 0.006069273 18.72807 0.00000000
15. VAS(3,3) 0.111560471 0.006034501 18.48711 0.00000000
16. VBS(1,1) 0.883932095 0.007840007 112.74634 0.00000000
17. VBS(2,1) 0.890954842 0.006562869 135.75692 0.00000000
18. VBS(2,2) 0.860825075 0.007291479 118.05905 0.00000000
19. VBS(3,1) 0.897614729 0.005767301 155.63860 0.00000000
20. VBS(3,2) 0.874828215 0.006242926 140.13112 0.00000000
21. VBS(3,3) 0.877439261 0.005991219 146.45422 0.00000000
MAXIMIZE - Estimation by BFGS
Convergence in 53 Iterations. Final criterion was 0.0000000 <= 0.0000100
Usable Observations 6236
Function Value -12817.3747
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. MU(1) -0.000774394 0.006339526 -0.12215 0.90277757
2. MU(2) -0.004265435 0.006088158 -0.70061 0.48354537
3. MU(3) 0.003650038 0.007187500 0.50783 0.61157161
4. VCV(1) 0.016829240 0.002136267 7.87787 0.00000000
5. VCV(2) 0.028388105 0.002501625 11.34787 0.00000000
6. VCV(3) 0.032309332 0.002924935 11.04617 0.00000000
7. VAV(1) 0.164136541 0.011604019 14.14480 0.00000000
8. VAV(2) 0.133212681 0.008151332 16.34244 0.00000000
9. VAV(3) 0.112704988 0.007014455 16.06753 0.00000000
10. VBV(1) 0.812626023 0.012303587 66.04789 0.00000000
11. VBV(2) 0.804332251 0.011084932 72.56087 0.00000000
12. VBV(3) 0.831308142 0.010000443 83.12713 0.00000000
13. QC(1,1) 0.564318758 0.008808561 64.06481 0.00000000
14. QC(2,1) 0.579294828 0.008496648 68.17922 0.00000000
15. QC(2,2) 0.828697094 0.003757082 220.56934 0.00000000
Note that the QC's in this are offset by 1 in the row, so QC(1,1) is actually the correlation between 2 and 1.
Copyright © 2026 Thomas A. Doan