I am currently doing the forecast of VaR (Value at Risk) by using GARCH and EGARCH. I am going to do the forecast by using rolling method. It will be much appreciated if anyone could provide any help with the codes on EGARCH on the rolling basis. Let’s assume that variable x consists of 200 observations and that the iteration for the out-of-sample period takes place 100 times. The mean equation is a simple AR(2). I have created the following code, but unfortunately doesn’t work. Should I change the command ‘makegarch’ to something else? The reason I am asking this is that, by theory, I should include the ln of variance in the left side of the equation?
Code: Select all
for !t=1 to 100
smpl @first+!t-1 @last-100+!t-1
equation temp_1.arch(1,1,m=200,h, c=0.001) {%x} c {%x}(-1) {%x}(-2)
'SPOT = C(1) + C(2)* SPOT(-1) + C(3)* SPOT(-2)
'GARCH = C(4) + C(5)* log(GARCH(-1)) + C(6)* @abs(RESID(-1)/@sqrt(GARCH(-1))) + C(7)* RESID(-1)/@sqrt(GARCH(-1)) RESID(-1)/@sqrt(GARCH(-1))
temp_new1.makegarch garch_1
temp_new1.makeresid res_1
temp_new1.makeresid(s) res_2
!c1 = temp_1.c(1)
!c2 = temp_1.c(2)
!c3= temp_1.c(3)
!c4=temp_1.c(4)
!c5=temp_1.c(5)
!c6=temp_1.c(6)
!c7=temp_1.c(7)
coef(1) log(var1) = !c4+!c5* log(garch_1(!s-100+!t-1))+!c6*(@abs(res_1(!s-100+!t-1)/(@sqrt garch_1(!s-100+!t-1))+!c(7)* (res_1(!s-100+!t-1)/(@sqrt garch_1(!s-100+!t-1))
forecasts(!t,1)= !c1+!c2*{%x}(!s-100+!t-1)+var1(1)*@quantile(res_2, !confi)
next[code][b][/b][/code]