Page **1** of **1**

### Dynamic forecasting with coefficient update in a VEC-model

Posted: **Sat Nov 15, 2008 8:07 am**

by **niels**

In Eviews there is a sample program on how to do a rolling forecast with coefficient update (rollfcst1.pgm) when you have an equation. I am working with an VECM and since the dynamic forecasting option is only with constant coefficient estimates (I assume) I am not sure how to do the forecast.

Regards

NIels

### Re: Dynamic forecasting with coefficient update in a VEC-model

Posted: **Mon Nov 17, 2008 1:49 pm**

by **niels**

I am trying to create a dynamic forecasting for a VEC-model which also re-estimates the model after each forecast. But I have problems with storing the data in the temporary file (receive the message "TMP_EURUSD_FC is not defined in "GENR EURUSD_FC = TMP_EURUSD_FC"). The program is as follows:

' Estimate VEC and forecast (with rolling regression and coefficient update)

' load workfile

load rådata_forecast

' set window size

!window = 265

' get size of workfile

!length = @obsrange

' Sample for estimation

smpl 1981:3 2003:3

' declare series for final results

series eurusd_fc ' point estimates

series eurusd_fc_se ' forecast std.err.

' set step size (1 month)

!step = 1

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

' set sample to estimation period

smpl @first+!i-1 @first+!i+!window-2

' estimate VEC with 1 cointegration relationship

var vec1.ec(c,1) 1 2 eurusd m1_usdeur ip_usdeur _3m_usdeur @ seas02 seas03 seas04 seas05 seas06 seas07 seas08 seas09 seas10 seas11 seas12

' make model out of estimated VEC

var.makemodel(mod1)

'reset sample to forecast period

smpl @first+!i+!window-1 @first+!i+!window-2+!step

' solve model to obtain dynamic forecasts and save forecasts in temporary series first

mod1.solve (f=na) tmp_eurusd_fc tmp_eurusd_fc_se

' copy data in current forecast sample

eurusd_fc = tmp_eurusd_fc

eurusd_fc_se = tmp_eurusd_fc_se

next

Regards

Niels

### Re: Dynamic forecasting with coefficient update in a VEC-model

Posted: **Mon Nov 17, 2008 2:03 pm**

by **EViews Gareth**

It looks like you're trying to use the model.solve command in the same way you would use an equation.forecast command. Unfortunately the way they work is slightly different.

For an equation.forecast, you need to specify the name of the series you wish to forecast into, and, optionally, the name of a series you wish to save the forecast standard errors into.

With a model.solve you don't specify the names that way. The forecasted values will, by default, by saved into a new series that has the same name as the original series, but with a _0 suffix.

### Re: Dynamic forecasting with coefficient update in a VEC-model

Posted: **Tue Nov 18, 2008 5:10 am**

by **niels**

Thanks for your quick answer. I modifed the program and the results are stored in a series. But the problem now is that the forecast-serie from the program differs the forecasts obtained manually (by making a model from the VEC-specification and then solve the model). When I am running the forecast manually I estimate the VEC w/fixed window, forecast the variable like 3 months ahead, store the forecast output, and then move the sample period 1 period ahead, and repeating the procedure. I enclose the program-script again.

' Estimate VEC and forecast (with rolling regression and coefficient update)

' load workfile

load rådata_forecast

' set window size

!window = 265

' get size of workfile

!length = @obsrange

' Sample for estimation

smpl 1980:1 2002:1

' declare series for final results

series eurusd_fc ' point estimates

' set step size (3 month)

!step = 3

' move sample !step obs at a time

for !i = 1 to !length-!window+1-!step step !step

' set sample to estimation period

smpl @first+!i-1 @first+!i+!window-2

' estimate VAR

var vec1.ec(c,1) 1 2 eurusd m1_usdeur ip_usdeur _3m_usdeur @ seas02 seas03 seas04 seas05 seas06 seas07 seas08 seas09 seas10 seas11 seas12

' make model out of estimated VAR

var.makemodel(mod1)

'reset sample to forecast period

smpl @first+!i+!window-1 @first+!i+!window-2+!step

' solve model to obtain dynamic forecasts and save in forecasts in temporary series first

mod1.solve (f=na) tmp_eurusd_fc

'Save forecast in the serie eurusd_fc

' copy data in current forecast sample

eurusd_fc = eurusd_0

next

### Re: Dynamic forecasting with coefficient update in a VEC-model

Posted: **Sat Jun 05, 2010 6:21 pm**

by **Mr.Bratwurst**

I'd love to see the solution as i am facing a similar problem....

anyone?

thx

### Re: Dynamic forecasting with coefficient update in a VEC-model

Posted: **Wed Dec 01, 2010 4:12 am**

by **oek_stat**

I think you only have to delete the following code from your program:

'reset sample to forecast period

smpl @first+!i+!window-1 @first+!i+!window-2+!step

The VEC-Estimation works with lags. So you don't use the last data point of the estimation sample. Therefore you don't have to change your sample size for the forecast.

Please tell me wether I am right!