Page 1 of 1

Out of Sample Forecasting using a VAR as a Model

Posted: Wed Aug 10, 2011 2:07 pm
by noconomist
Hi, please help me with this issue.
I noticed that there is no way of making an out of sample forecast using the model option, say a VAR. This seems a little strange since there is an option for doing dynamic forecasting, using previously forecasted predetermined and exogenous variables, when doing an in-sample forecast. This could in principle be easily extrapolated for out of sample forecasting, but apparently this is not an option. Would anyone please tell me if I am wrong and indicate me how to do it? Otherwise, is there an option to export the system of equations (say coeffs) of a model in order to perform the out of sample forecast myself? Thank you in advance. Nocono. :shock:

Just in case, by in-sample I mean my estimation sample, and the total sample of my workfile (smpl) would be the estimation sample + forecast sample. :wink:

Re: Out of Sample Forecasting using a VAR as a Model

Posted: Wed Aug 10, 2011 2:21 pm
by EViews Gareth
I'm not sure I understand what you are saying. You can certainly perform an out-of-sample forecast using the model object.

Re: Out of Sample Forecasting using a VAR as a Model

Posted: Wed Aug 10, 2011 2:36 pm
by noconomist
Hi, thanks for answering. This is my program:


'Sample Size of workfile
smpl 1980q1 2010q4

'Estimating the Cointegrating vector via OLS smpl 1980q1 2010q4
smpl 1980q1 2004q4
equation longrun11.ls impor c var02 var07

'Saving Residuals
series resm11=resid
smpl 1980q1 2004q4

'Estimating VECM with Residuals. Note.- No constant or trend on VECM. Exogenous variable: var10=log(xgdp)
var vec11.ls(noconst) 1 1 d(impor) d(var02) d(var07) @ resm11(-1) dvar10(-1)

'****************************************
'************FORECASTING***********
'****************************************
'NOTE: Estimation period 1980q1 2004q4
'Forecasting period 2005q1 2010q4

'Forecast with Forecasted Values of Regressors (Dynamic)
vec11.makemodel(mod11)
mod11.scenario(n, a="_exf") "Exogenous Forecasted"
smpl 2005q1 2010q4
mod11.solve(d=d)



The result I obtain when I run it says "Unable to compute due to missing data in... (explains the first equation of the system)". Can you please explain me what am I doing wrong? Thanks a lot.

Re: Out of Sample Forecasting using a VAR as a Model

Posted: Wed Aug 10, 2011 2:42 pm
by EViews Gareth
Seems to work for me (with generated data):

Code: Select all

create q 1980 2010 series resm11 = nrnd series dvar10 = nrnd smpl 1980 2004q4 series impor = nrnd series var02 = nrnd series var07 = nrnd '---------------------------------------------- 'Sample Size of workfile smpl 1980q1 2010q4 'Estimating the Cointegrating vector via OLS smpl 1980q1 2010q4 smpl 1980q1 2004q4 equation longrun11.ls impor c var02 var07 'Saving Residuals series resm11=resid smpl 1980q1 2004q4 'Estimating VECM with Residuals. Note.- No constant or trend on VECM. Exogenous variable: var10=log(xgdp) var vec11.ls(noconst) 1 1 d(impor) d(var02) d(var07) @ resm11(-1) dvar10(-1) '**************************************** '************FORECASTING*********** '**************************************** 'NOTE: Estimation period 1980q1 2004q4 'Forecasting period 2005q1 2010q4 'Forecast with Forecasted Values of Regressors (Dynamic) vec11.makemodel(mod11) mod11.scenario(n, a="_exf") "Exogenous Forecasted" smpl 2005q1 2010q4 mod11.solve(d=d)

Re: Out of Sample Forecasting using a VAR as a Model

Posted: Thu Aug 11, 2011 6:13 am
by noconomist
Hi, thanks for responding again. I see a little problem with your setting in the following sense:

When you create these series up until 2010 in the following line

Code: Select all

create q 1980 2010 series resm11 = nrnd series dvar10 = nrnd
they would feed the 'model' for forecasting (for the out of sample forecast period 2004-2010) as actual values, wouldnt' they?. What I was trying to do is not to tell the program about any actual data after 2004, so I can have a fully out-of-sample forecast, because even when I put just one exogenous variable in the VAR forecast with actual values for the out-of-sample period I would be cheating the results. When I try to put these variables (resm11 and dvar10) originally restricted to 2004 then the program tells me "Unable to compute due to missing data in ..(first eq of the model)".

Best, Nocono.

Out of Sample Forecasting using a VAR as a Model

Posted: Thu Aug 11, 2011 6:28 am
by EViews Gareth
You specified those two variables as exogenous variables. As such they will not be forecasted. Thus you'll need actual data for them over any forecast period.

Re: Out of Sample Forecasting using a VAR as a Model

Posted: Fri Aug 12, 2011 11:28 am
by noconomist
You're right. Thanks! I did not realize that. :mrgreen: