Forecast with endogenous and exogenous variables

For questions regarding programming in the EViews programming language.

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

niels
Posts: 14
Joined: Mon Nov 10, 2008 1:30 am

Forecast with endogenous and exogenous variables

Postby niels » Mon Jan 05, 2009 1:51 am

Hi !
I am using a vector error correction model (VEC) to perform forecast with. When I run the program (see below) it assumes that all variables are endogenous. Is it possible to keep only one the variables as endogenous and the rest as exogenous ? Maybe I need to add something to the .solve line....I hope there is someone who can help me!

Niels

'Estimate VEC-model 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

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

Re: Forecast with endogenous and exogenous variables

Postby EViews Gareth » Mon Jan 05, 2009 9:24 am

You can use the exclude command to list variables that you want to treat as exogenous.

niels
Posts: 14
Joined: Mon Nov 10, 2008 1:30 am

Re: Forecast with endogenous and exogenous variables

Postby niels » Mon Jan 05, 2009 2:49 pm

Yes, it works. However, there is one problem. When I run the program with
' set step size is 3 month
!step = 3

' move sample !step obs at a time
for !i = 1 to !length-!window+1-!step step !step

I thought the result would be a 3 month forecast from today, move sample 1 period ahead and then make new 3 month forecast and so on. So in the end I would have obtained a series of 3 month forecasts. But that's not what I get. Instead the result is a 3 month forecast for one forecast date and then a 1 month forecast for the month afterwards and so on. I find it very strange...

jochen.blessing
Posts: 2
Joined: Mon Jul 20, 2009 6:00 am

Re: Forecast with endogenous and exogenous variables

Postby jochen.blessing » Mon Jul 20, 2009 6:40 am

You can use the exclude command to list variables that you want to treat as exogenous.
Hi Gareth, I have been using your advice in forecasting from a three variables VECM where two variables were declared as exogenous over the forecasting horizon. To my understanding, exclude var1 var2 should produce the same forecasting result for the one remaining endogenous variable as exlude(actexist=true). However, this is not the case. Any explanation would be extremely useful.

best

JB

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

Re: Forecast with endogenous and exogenous variables

Postby EViews Gareth » Mon Jul 20, 2009 8:07 am

I don't understand why you think that would be the case.

jochen.blessing
Posts: 2
Joined: Mon Jul 20, 2009 6:00 am

Re: Forecast with endogenous and exogenous variables

Postby jochen.blessing » Tue Jul 21, 2009 12:13 am

Hi again, thanks for your quick response,

could you please explain what the exact difference is between "exclude var1 var2" and "exlude(actexist=true)" when var1 and var2 are treated as exogenous over the forecasting horizon (i.e. I have data provided on var1 and var2 that should remain fixed over the forecasting horizon).

To my understanding, excluding vars means they are treated as exogenous, hence lagged values of var1 and var2 will not be used in forecasting var3 (where var3 is the remaining endogenous variable of the original three variable VECM), as "current", exogenous, values of var1 and var2 can be used instead. This should be the same as excluding vars for which data is available.

best

JB

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

Re: Forecast with endogenous and exogenous variables

Postby EViews Gareth » Tue Jul 21, 2009 8:06 am

Could you post your workfile?

joe96
Posts: 1
Joined: Wed Jul 22, 2009 1:15 am

Re: Forecast with endogenous and exogenous variables

Postby joe96 » Wed Jul 22, 2009 2:21 am

Could you post your workfile?
Attached you find the relevant bits of code,

' the model estimates a demand function, gdp and prices are given over the forecasting horizon, prices are given by forwards

smpl 2000q1 2008q4
var ec_{%country}.ec(a) 1 2 log(demand_{%country}) log(gdp_{%country}) log(p_{%country})
ec_{%country}.makemodel(ecm_{%country})
' Forecast
smpl 2009q1 2014q4
' exclude variables in solution that are treated as exogenous (=given by other sources of forecasts, i.e. for which "actuals" are available), in our case these are gdp and price variable
'ecm_{%country}.exclude(actexist=true)
ecm_{%country}.exclude gdp_{%country} p_{%country}
' solve model = produce forecast
ecm_{%country}.solve(s=a)
' the model produces different paths for demand_{%country} depending on whether the actexist command is used or whether variables are excluded explicitly.

hope this helps, thanks in advance

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

Re: Forecast with endogenous and exogenous variables

Postby EViews Gareth » Wed Jul 22, 2009 8:21 am

Well, I'm not sure what you're doing wrong. Perhaps the data isn't as available as you think. Here's a test program I knocked up that seems to indicate it is working:

Code: Select all

rndseed 1 create q 1998 2014 series x2=rnd series x3=rnd smpl 1998 2008 series x1=rnd smpl 2000 2008 var ec.ec(a) 1 2 log(x1) log(x2) log(x3) ec.makemodel(ecm) smpl 2009 2014 ecm.scenario(c,n,a="_man") "manual" ecm.exclude x2 x3 ecm.solve(a=f) ecm.scenario(c, n,a="_ax") "autoex" ecm.exclude(actexist=true) ecm.solve(a=f) show x1_man x1_ax


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests