Re: Estimation of VAR(1)-GARCH(1,1) model
Posted: Mon Jun 08, 2015 7:22 am
You can't print a FRML, but you can create a series with its values:
set r1 = e_r1
set r2 = e_r2
print / r1 r2
set r1 = e_r1
set r2 = e_r2
print / r1 r2
A Forum for RATS Software and Econometrics Discussions
https://www.estima.com/forum/
Code: Select all
system(model=V1)
variables rkse rwti
lags 1
det constant
end(system)
*estiamte
garch(model=V1, p=1,q=1,mv=cc,variance=varma,mvhseries=hhkse_wti,stdresids=reskse_wti,pmethod=simplex,piteration=13, robust,method=bfgh)Code: Select all
nonlin c1 c2 c3 c4 c5
frml e = dollar(t)-c1
set h = .01
frml var = c2+c3*(abs(e(t-1)/h(t-1))-sqrt(2/%pi))+c4*log(h(t-1))+c5*(e(t-1)/h(t-1))
frml gln = h=exp(var(t)), %logdensity(h, e)
smpl 3 3388
compute c1= .17, c2 = 0.13, c3 = 0.8, c4 = .1, c5 = .0003
maximize(method=bfgh,iterations=500,rob) gln
Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in 41 Iterations. Final criterion was 0.0000026 <= 0.0000100
With Heteroscedasticity/Misspecification Adjusted Standard Errors
Usable Observations 3386
Function Value -2308.0730
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. C1 -0.001845425 0.007264174 -0.25404 0.79946099
2. C2 0.002808800 0.002303969 1.21911 0.22280117
3. C3 0.035622732 0.003410383 10.44537 0.00000000
4. C4 1.019540332 0.002793323 364.99189 0.00000000
5. C5 0.010143690 0.002605036 3.89388 0.00009865
Code: Select all
GARCH(P=1,Q=1,EXP,ASYMMETRIC,rob) / DOLLARCode: Select all
GARCH Model - Estimation by BFGS
Convergence in 26 Iterations. Final criterion was 0.0000000 <= 0.0000100
With Heteroscedasticity/Misspecification Adjusted Standard Errors
Dependent Variable DOLLAR
Usable Observations 3386
Log Likelihood -2297.7150
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Mean(DOLLAR) -0.003623162 0.007336290 -0.49387 0.62139904
2. C -0.059493771 0.008272032 -7.19216 0.00000000
3. A 0.073091975 0.009842794 7.42594 0.00000000
4. B 0.995051320 0.001739255 572.11338 0.00000000
5. D 0.016531933 0.006827503 2.42137 0.01546200
Code: Select all
open data d-spcscointc.txt
data(format=free,org=columns,top=2) 1 2275 sp500 cisco intel
set r1 = sp500
set r2 = cisco
*
*
stats(noprint) r1
set h1 = %variance
stats(noprint) r2
set h2 = %variance
*
nonlin a10 a20 a11 a12 a21 a22 c10 c20 c11 c12 c21 c22 d1 d2 d11 d22 rho
frml e_r1 = r1(t)-a10-a11*r1(t-1)-a12*r2(t-1)
frml e_r2 = r2(t)-a20-a21*r1(t-1)-a22*r2(t-1)
frml fr1 = (abs(e_r1/sqrt(h1))-sqrt(2/%pi))
frml fr2 = (abs(e_r2/sqrt(h2))-sqrt(2/%pi))
frml asy1 = e_r1/sqrt(h1) * asymetric codes
frml asy2 = e_r2/sqrt(h2) * asymetric codes
frml var_r1 = exp(c10+c11*(fr1(t-1)+d11*asy1(t-1))+c12*(fr2(t-1)+d22*asy2(t-1))+d1*log(h1(t-1))
frml var_r2 = exp(c20+c21*(fr1(t-1)+d11*asy1(t-1))+c22*(fr2(t-1)+d22*asy2(t-1))+d2*log(h2(t-1))
frml gln = h1 = var_r1(t), h2 = var_r2(t), %logdensity(||h1|rho*sqrt(h1*h2),h2||,||r1,r2||)
smpl 3 2275
compute a10 = 01, a20 = .2, a11 = .03, a12 = .04, a21 = .09, a22 = .08
compute c10 = .01, c20 = .04, c11= .04, c22 = .014, c12=.08, c21=.06, rho=.05
compute d1 = .01, d2 = .08, d11 = .04, d12 = .08, d21 = .088, d22 = .03
maximize(method=bfgh,ite=500) gln
Code: Select all
GARCH(P=1,Q=1,MV=CC,VARIANCES=KOUTMOS,REGRESSORS) / R1 R2
# Constant R1{1} R2{1}
Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in 371 Iterations. Final criterion was 0.0000018 <= 0.0000100
Usable Observations 2273
Function Value -7806.3133
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. A10 0.94654129 0.01186322 79.78789 0.00000000
2. A20 -0.96897829 0.01572007 -61.63958 0.00000000
3. A11 1.79161573 0.02272365 78.84367 0.00000000
4. A12 -1.70074997 0.01836631 -92.60160 0.00000000
5. A21 -14.10914474 0.06518259 -216.45571 0.00000000
6. A22 0.83065515 0.00371228 223.75862 0.00000000
7. C10 -0.14594409 0.01654922 -8.81879 0.00000000
8. C20 0.03537544 0.01832068 1.93090 0.05349513
9. C11 0.00717189 0.00179060 4.00529 0.00006194
10. C12 0.04181039 0.00430738 9.70668 0.00000000
11. C21 0.02385552 0.00251985 9.46704 0.00000000
12. C22 0.02444275 0.00346553 7.05312 0.00000000
13. D1 0.92168316 0.00871321 105.78001 0.00000000
14. D2 0.91104776 0.01202741 75.74760 0.00000000
15. D11 0.13514001 0.22268733 0.60686 0.54394389
16. D22 -0.54256036 0.05862743 -9.25438 0.00000000
17. RHO 0.52085735 0.01427604 36.48473 0.00000000
Code: Select all
MV-CC GARCH with Koutmos EGARCH Variances - Estimation by BFGS
Convergence in 71 Iterations. Final criterion was 0.0000087 <= 0.0000100
Usable Observations 2273
Log Likelihood -7779.2762
Variable Coeff Std Error T-Stat Signif
************************************************************************************
Mean Model(R1)
1. Constant 0.046929299 0.014274026 3.28774 0.00100995
2. R1{1} 0.003722419 0.023733139 0.15684 0.87536719
3. R2{1} 0.015022205 0.005620426 2.67279 0.00752238
Mean Model(R2)
4. Constant 0.215860800 0.050275648 4.29355 0.00001758
5. R1{1} -0.035825474 0.067177772 -0.53329 0.59383037
6. R2{1} 0.048751335 0.021288114 2.29007 0.02201708
7. C(1) -0.094504902 0.013451492 -7.02561 0.00000000
8. C(2) -0.006286595 0.016493744 -0.38115 0.70309173
9. A(1,1) 0.117605462 0.015763261 7.46073 0.00000000
10. A(1,2) -0.020509391 0.012259182 -1.67298 0.09433085
11. A(2,1) -0.005126020 0.007676322 -0.66777 0.50428020
12. A(2,2) 0.105497797 0.017962805 5.87312 0.00000000
13. B(1) 0.980616989 0.004045214 242.41409 0.00000000
14. B(2) 0.969452251 0.006773487 143.12454 0.00000000
15. D(1) -0.537680096 0.097963254 -5.48859 0.00000004
16. D(2) -1.007991409 0.183890841 -5.48147 0.00000004
17. R(2,1) 0.519248141 0.014852537 34.96023 0.00000000
Code: Select all
open data d-spcscointc.txt
data(format=free,org=columns,top=2) 1 2275 sp500 cisco intel
set r1 = sp500
set r2 = cisco
*
* This replaces your initialization of variances to zero.
*
stats(noprint) r1
set h1 = %variance
stats(noprint) r2
set h2 = %variance
*
nonlin a10 a20 a11 a12 a21 a22 c10 c20 c11 c12 c21 c22 d1 d2 d11 d22 c30 c31 c32
frml e_r1 = r1(t)-a10-a11*r1(t-1)-a12*r2(t-1)
frml e_r2 = r2(t)-a20-a21*r1(t-1)-a22*r2(t-1)
frml fr1 = (abs(e_r1/sqrt(h1))-sqrt(2/%pi))
frml fr2 = (abs(e_r2/sqrt(h2))-sqrt(2/%pi))
frml asy1 = e_r1/sqrt(h1)
frml asy2 = e_r2/sqrt(h2)
frml var_r1 = exp(c10+c11*(fr1(t-1)+d11*asy1(t-1))+c12*(fr2(t-1)+d22*asy2(t-1))+d1*log(h1(t-1)))
frml var_r2 = exp(c20+c21*(fr1(t-1)+d11*asy1(t-1))+c22*(fr2(t-1)+d22*asy2(t-1))+d2*log(h2(t-1)))
frml u = c30+c31*fr1(t-1)*fr2(t-1)+c32*u(t-1)
frml rho = (1-exp(-u(t)))/(1+exp(-u(t)))
frml gln = h1 = var_r1(t), h2 = var_r2(t),correl=rho(t), %logdensity(||h1|correl*sqrt(h1*h2),h2||,||e_r1,e_r2||)
smpl 3 2275
compute a10 = 01, a20 = .2, a11 = .03, a12 = .04, a21 = .09, a22 = .08
compute c10 = .01, c20 = .04, c11= .04, c22 = .014, c12=.08, c21=.06
compute d1 = .01, d2 = .08, d11 = .04, d12 = .08, d21 = .088, d22 = .03
compute c30=.04, c31=.004,c32=0.08
maximize(method=bfgh,ite=500,pit=30,pmet=sim) gln
Code: Select all
GARCH(MODEL=V1, P=1,Q=1,MV=CC,VARIANCE=VARMA,MVHSERIES=HH_1_2,asy, $
STDRESIDS=RES_1_2,PMETHOD=SIMPLEX,PITERATION=02,METHOD=BFGh,hmatrices=hh,rvectors=rd)
Code: Select all
set z1 = rd(t)(1)/sqrt(hh(t)(1,1))
set z2 = rd(t)(2)/sqrt(hh(t)(2,2))Code: Select all
STDRESIDS=RES_1_2Code: Select all
SET RES_1 = RES_1_2(1)
SET RES_2 = RES_1_2(2)