Kalman GARCH
Posted: Tue Nov 27, 2012 10:21 am
Hello,
I saw various subject on the forum dealing with how to include garch effect into the state space object. As it require to use a modified kalman filter to deal with the non-linearity, there is no solution directly in Eviews.
My objective is to estimate a CAPM and to get thanks to the kalman filter time varying coefficient. I would like to put a garch(1,1) effect on the error of my CAPM (like in GROUT and ZALEWSKA). To deal with this problem i have proceed recursively :
Estimate time varying beta
Estimate garch volatility using the previously estimated beta
Estimating again time varying beta but with the exogenous volatility previously estimated
Estimating again the volatility with new beta
doing the procedure again and again until convergence of parameters
For me this procedure work fine, and beginning with the kalman filter or the garch don't seem to change nothing. However, I would like to know if this methods is not misleading. For me it's better than estimating the CAPM without garch effect, but i would like to have your advice.
I hope i've made myself clear (sorry for my english), here i put my eviews code, thank you very much for your help :
smpl @all
'Initial values estimation
smpl @first @first+91
equation eq_ftel_ini.ls rfc_ftel rfc_sbf c
sym(2) svar2=eq_ftel_ini.@coefcov
vector svec2=eq_ftel_ini.@coef
smpl @all
'Time varying beta estimation with constant volatility
sspace ftel_ss
ftel_ss.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var = exp(c(1))]
ftel_ss.append @state sv1 = sv1(-1) + [var = exp(c(2))]
ftel_ss.append @state sv2 = sv2(-1) + [var = exp(c(3))]
ftel_ss.append @mprior svec2
ftel_ss.append @vprior svar2
ftel_ss.ml
ftel_ss.makestates(filt) ftel_beta ftel_alpha
'Volatility estimation with GARCH(1,1)
equation eq_garch1.arch rfc_ftel-ftel_beta*rfc_sbf-ftel_alpha
eq_garch1.makegarch ftel_garch1
'Beta estimation with previously estimated volatility
sspace ftel_ss1
ftel_ss1.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var = ftel_garch1]
ftel_ss1.append @state sv1 = sv1(-1) + [var = exp(c(1))]
ftel_ss1.append @state sv2 = sv2(-1) + [var = exp(c(2))]
ftel_ss1.append @mprior svec2
ftel_ss1.append @vprior svar2
ftel_ss1.ml
ftel_ss1.makestates(filt) ftel_beta_1 ftel_alpha_1
'Iterative estimation between kalman and garch
for %num %pnum 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14
equation eq_garch{%num}.arch rfc_ftel-ftel_beta_{%pnum}*rfc_sbf-ftel_alpha_{%pnum}
eq_garch{%num}.makegarch ftel_garch{%num}
sspace ftel_ss{%num}
ftel_ss{%num}.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var =ftel_garch{%num}]
ftel_ss{%num}.append @state sv1 = sv1(-1) + [var = exp(c(1))]
ftel_ss{%num}.append @state sv2 = sv2(-1) + [var = exp(c(2)) ]
ftel_ss{%num}.append @mprior svec2
ftel_ss{%num}.append @vprior svar2
ftel_ss{%num}.ml
ftel_ss{%num}.makestates(filt) ftel_beta_{%num} ftel_alpha_{%num}
next
I saw various subject on the forum dealing with how to include garch effect into the state space object. As it require to use a modified kalman filter to deal with the non-linearity, there is no solution directly in Eviews.
My objective is to estimate a CAPM and to get thanks to the kalman filter time varying coefficient. I would like to put a garch(1,1) effect on the error of my CAPM (like in GROUT and ZALEWSKA). To deal with this problem i have proceed recursively :
For me this procedure work fine, and beginning with the kalman filter or the garch don't seem to change nothing. However, I would like to know if this methods is not misleading. For me it's better than estimating the CAPM without garch effect, but i would like to have your advice.
I hope i've made myself clear (sorry for my english), here i put my eviews code, thank you very much for your help :
smpl @all
'Initial values estimation
smpl @first @first+91
equation eq_ftel_ini.ls rfc_ftel rfc_sbf c
sym(2) svar2=eq_ftel_ini.@coefcov
vector svec2=eq_ftel_ini.@coef
smpl @all
'Time varying beta estimation with constant volatility
sspace ftel_ss
ftel_ss.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var = exp(c(1))]
ftel_ss.append @state sv1 = sv1(-1) + [var = exp(c(2))]
ftel_ss.append @state sv2 = sv2(-1) + [var = exp(c(3))]
ftel_ss.append @mprior svec2
ftel_ss.append @vprior svar2
ftel_ss.ml
ftel_ss.makestates(filt) ftel_beta ftel_alpha
'Volatility estimation with GARCH(1,1)
equation eq_garch1.arch rfc_ftel-ftel_beta*rfc_sbf-ftel_alpha
eq_garch1.makegarch ftel_garch1
'Beta estimation with previously estimated volatility
sspace ftel_ss1
ftel_ss1.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var = ftel_garch1]
ftel_ss1.append @state sv1 = sv1(-1) + [var = exp(c(1))]
ftel_ss1.append @state sv2 = sv2(-1) + [var = exp(c(2))]
ftel_ss1.append @mprior svec2
ftel_ss1.append @vprior svar2
ftel_ss1.ml
ftel_ss1.makestates(filt) ftel_beta_1 ftel_alpha_1
'Iterative estimation between kalman and garch
for %num %pnum 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14
equation eq_garch{%num}.arch rfc_ftel-ftel_beta_{%pnum}*rfc_sbf-ftel_alpha_{%pnum}
eq_garch{%num}.makegarch ftel_garch{%num}
sspace ftel_ss{%num}
ftel_ss{%num}.append @signal rfc_ftel = sv2 + sv1*rfc_sbf + [var =ftel_garch{%num}]
ftel_ss{%num}.append @state sv1 = sv1(-1) + [var = exp(c(1))]
ftel_ss{%num}.append @state sv2 = sv2(-1) + [var = exp(c(2)) ]
ftel_ss{%num}.append @mprior svec2
ftel_ss{%num}.append @vprior svar2
ftel_ss{%num}.ml
ftel_ss{%num}.makestates(filt) ftel_beta_{%num} ftel_alpha_{%num}
next