Rolling volatility forecasts

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

deeh
Posts: 2
Joined: Mon Mar 22, 2010 5:56 pm

Rolling volatility forecasts

Postby deeh » Mon Mar 22, 2010 6:19 pm

Hello,

I am doing rolling volatility forecasts for my dissertation but I am having issues with the coding. More specifically, I cannot figure out how to save the conditional variance, let alone forecast it. I would also like to add a variance regressor for the conditional variance estimation, but I have been unable to find answers in the EViews Programming Reference. I am using EViews 6. I also did look at other examples on the forums here, but I did not find the answer I was looking for.

Here is my code (taken from one of the included examples and modified):

Code: Select all

!window = 525 !length = @obsrange equation eq7 smpl @first @first+!window-1 series retftse100hat series cvarhat !step = 5 for !i = 1 to !length-!window+1-!step step !step eq7.arch(1,1) retftse100-rf retasx-rf eq7.makegarch tmp_cvarhat smpl @first+!i+!window-1 @first+!i+!window-2+!step eq7.forecast(f=na) tmp_retftse100hat retftse100hat = tmp_retftse100hat cvarhat = tmp_cvarhat
When I run the code, only the conditional variance from the very last sample is saved in tmp_cvarhat (no results are saved in cvarhat). Of course those are not even the forecasted conditional variances, which I have no clue how to get. I would also like to add a variance regressor called 'iv' to the conditional variance, but have no idea how to do it. Having said that, the code works perfectly well for the mean equation.

If anyone can provide suggested modifications to the code such that the conditional variance is forecasted and saved like the mean equation, as well as how to add the variance regressor to the conditional variance equation, I would very much appreciate it.

With thanks,
deeh

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Rolling volatility forecasts

Postby EViews Gareth » Mon Mar 22, 2010 6:30 pm

Haven't run your code, but just looking at it, it seems you're not setting the sample used during estimation. That's the step you're missing, I think. You're setting the forecast sample, but not the estimation sample.

You can add a variance terms with an @ symbol. Thus to add "x" as a variance term, you'd use:

Code: Select all

eq7.arch(1,1) retftse100-rf retasx-rf @ x
You can forecast the variance term by specifying both a name for it and the forecasted standard errors after the forecast proc:

Code: Select all

eq_name.forecast y_forecast y_se y_garch
The Equation section of the Object Reference contains more details.

deeh
Posts: 2
Joined: Mon Mar 22, 2010 5:56 pm

Re: Rolling volatility forecasts

Postby deeh » Tue Mar 23, 2010 9:10 am

That seemed to do the trick. Thank you very much for your assistance.

As for your first point: doesn't "!window = 525" set the sample size for estimation as 525 and "!step = 5" set the number of observations to forecast ahead?

Best,
deeh

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13600
Joined: Tue Sep 16, 2008 5:38 pm

Re: Rolling volatility forecasts

Postby EViews Gareth » Tue Mar 23, 2010 9:45 am

No, !window and !step are just scalars. You have to use those scalars to set the sample period in a smpl statement.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests