Generating series of 1 step ahead forecasts from VAR model

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

Intern
Posts: 4
Joined: Wed Oct 29, 2014 6:02 am

Generating series of 1 step ahead forecasts from VAR model

Postby Intern » Wed Oct 29, 2014 7:07 am

Hello all,

Please forgive the simplicity of my question as I am new to Eviews.

I have a data set covering the period 1993q1 to 2006q4. I am trying to generate a series of 1 step ahead ex-post forecasts starting from 2000q1 to 2006q4 using a VAR model. The idea is to estimate a VAR model using the sample 1993q1 to 1999q4 and generate a forecast for 2000q1, then estimate another VAR model with the sample 1993q1 to 2000q1 and generate a forecast for 2000q2, etc., repeating this step until the final date in the data set, then storing the resulting forecasts in a series.

My initial thought was to run the following code to estimate all the VAR models:

Code: Select all

for !i=0 to 24 smpl @first 1999q1+!i var var01!i.ls lgdp cci
where lgdp and cci are the endogenous variables in the VAR.

However, I get an error message saying that var!i is not a valid name.

Could anyone provide help how I can estimate many VAR models by using a loop command, or suggest a better way on how to tackle this problem?

Thank you.

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

Re: Generating series of 1 step ahead forecasts from VAR mod

Postby EViews Gareth » Wed Oct 29, 2014 9:17 am

You need to add the lags to your VAR.

Code: Select all

create q 1990 2020 series lgdp=nrnd series cci=nrnd for !i=0 to 24 smpl @first 1999q1+!i var var01!i.ls 1 2 lgdp cci next

Intern
Posts: 4
Joined: Wed Oct 29, 2014 6:02 am

Re: Generating series of 1 step ahead forecasts from VAR mod

Postby Intern » Thu Oct 30, 2014 1:29 am

Thank you for your quick reply!

I have successfully estimated the required VARs now, but I am having some trouble generating the forecasts needed and storing them in a series. So far my code looks like this:

Code: Select all

for !i=0 to 24 smpl @first 1999q1+!i var var01!i.ls 1 1 lgdp cci 'VAR forecasts var01!i.makemodel(mod01!i) mod01!i.solve smpl 2000q1+!i 2000q1+!i next
However the resulting series for the forecasts of lgdp, lgdp_0, only includes the forecasted value for 2006q1, but all the other values in lgdp_0 are just the actual observations. It seems that running the loop to solve all the models keeps overwriting the lgdp_0 series for each !i and only includes the last forecasted value in the series. Any idea on how I can store the forecasts for each !i in a series, and not have them being overwritten in the loop?

Thank you!

**Update

I tried modifying the code to the following:

Code: Select all

table fcast for !i=0 to 24 smpl @first 1999q1+!i var var01!i.ls 1 1 lgdp cci 'VAR forecasts var01!i.makemodel(mod01!i) mod01!i.solve smpl 2000q1+!i 2000q1+!i fcast(1+!i, 1)= @elem(lgdp_0, "2000q1+!i") next


with the intention of extracting the forecasts for each !i in the loop, and storing them in the table fcast before being overwritten.

However I get an error message saying that 2000q1+0 is an illegal date.

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

Re: Generating series of 1 step ahead forecasts from VAR mod

Postby EViews Gareth » Thu Oct 30, 2014 7:59 am

I would imagine you want your smpl statement before the solve command.

But your specific problem is that the @elem command doesn't recognise the "2000q1+!i" syntax.

You'll have to do something like:

Code: Select all

%date = @otod(@dtoo("2000q1")+!i) fcast(1+!i, 1)= @elem(lgdp_0, %date)


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests