First of all, I am using Eviews 6. Really confused about the difference between dynamic forecast and n-step ahead forecast of the state space models.
I have a state space model as follows:
@signal y = c(1)*y(-1) + c(2)*y(-2) + sv1 + sv2*t + [var = exp(c(3))]
@state sv1 = c(6) + c(7)*sv1(-1) + [var = exp(c(5))]
@state sv2 = c(9) + c(10)*sv2(-1) + [var = exp(c(8))]
I have annual data from 1860-2009 for y and would like to estimate a model using data up to 1979 and then reserve the 1980-2009 data for out-of-sample comparison. Eviews says "lagged endogenous variables will be treated as exogenous". Does it mean, say to forecast 1982 values, Eviews will take my actual rather than forecast y values in 1980 and 1981 in the signal equation?
Secondly, if I choose 1-step ahead forecast with a forecasting sample 1980-2009. I understand the 1980 forecast value will base on the final state variables, sv1 and sv2 in 1979, but how does Eviews compute the forecast for 1981-2009 for the n-step ahead forecast? any discussion is appreciated.
Shawn
State space out-of-sample forecast
Moderators: EViews Gareth, EViews Moderator
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: State space out-of-sample forecast
Yes, to the first question. We treat all of the variables on the RHS as exogenous. If you want the dynamics, you'll have to rewrite the model. For autoregressive models there should be a way to rewrite this in terms of the states (just as you can write an autoregression in terms of AR residuals).
Your last question is a bit confusing. Are you talking the one-step ahead for each of the periods from 1981 to 2009? Or an n-step ahead in this period. In the latter case, this is a pretty standard state space question so looking at our references will do a better job at explaining it that I can in a forum posting. Roughly speaking, we run the Kalman filter forecast forward starting n-periods before the specific period of the forecast of interest, and assume that the dependent variable is missing. This gives you the best predictors conditional on the information set at the start of the filter. It's really just the usual dynamic forecasting issue in the context of the Kalman filter...In the n-step context, you simply do it for each period in the forecast period, starting the filter n periods earlier...
Your last question is a bit confusing. Are you talking the one-step ahead for each of the periods from 1981 to 2009? Or an n-step ahead in this period. In the latter case, this is a pretty standard state space question so looking at our references will do a better job at explaining it that I can in a forum posting. Roughly speaking, we run the Kalman filter forecast forward starting n-periods before the specific period of the forecast of interest, and assume that the dependent variable is missing. This gives you the best predictors conditional on the information set at the start of the filter. It's really just the usual dynamic forecasting issue in the context of the Kalman filter...In the n-step context, you simply do it for each period in the forecast period, starting the filter n periods earlier...
Re: State space out-of-sample forecast
Glenn, many thanks for the excellent explanation.
Sorry for the confusion in my second question. What I really want is a 1-step (or 2-step) ahead forecast for each year in the period of 1980-2009. What I did was: first estimate the Kalman filter using data up to 1979; then under "Forecast" select "N-step ahead forecast" (N=1) and set the forecasting sample 1980-2009. In this case, has the forecast used all information up to the previous period? For example, has the forecasted 1990 value used all signal information up to 1989? If so, then I don't need to re-estimate the model. Otherwise, I assume I need to re-estimate the model using data up to t+n-1 before forecasting values of t+n for the one-step ahead forecast.
Shawn
Sorry for the confusion in my second question. What I really want is a 1-step (or 2-step) ahead forecast for each year in the period of 1980-2009. What I did was: first estimate the Kalman filter using data up to 1979; then under "Forecast" select "N-step ahead forecast" (N=1) and set the forecasting sample 1980-2009. In this case, has the forecast used all information up to the previous period? For example, has the forecasted 1990 value used all signal information up to 1989? If so, then I don't need to re-estimate the model. Otherwise, I assume I need to re-estimate the model using data up to t+n-1 before forecasting values of t+n for the one-step ahead forecast.
Shawn
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: State space out-of-sample forecast
It'll use the information up to 1979 to estimate the coefficients of the model. The one-step ahead for 1990 will use all of the signal information up to 1989, but the coefficients are through 1979. The initial conditions basically take the results for initialization and run them through 1989.
So if I'm understanding your question, you don't need to reestimate unless you want the coefficients updated as well. Note that if you do rewrite your model so that everything is in the states, then the one-step ahead will contain the "reestimation" (as in recursive coefficients models).
So if I'm understanding your question, you don't need to reestimate unless you want the coefficients updated as well. Note that if you do rewrite your model so that everything is in the states, then the one-step ahead will contain the "reestimation" (as in recursive coefficients models).
-
Victor_Naegele
- Posts: 2
- Joined: Wed Jun 18, 2014 6:24 am
Re: State space out-of-sample forecast
Hi Glenn,
I am using a similar model (almost identical) and I can´t forecast out of sample, I belive that the problem is that eviews treat all variables on the RHS as exogeneous, as you commented earlier:
"If you want the dynamics, you'll have to rewrite the model. For autoregressive models there should be a way to rewrite this in terms of the states (just as you can write an autoregression in terms of AR residuals)."
Could you give me any examples? I looked in the manual but couldn´t find any.
Thanks in advance.
Victor Naegele
I am using a similar model (almost identical) and I can´t forecast out of sample, I belive that the problem is that eviews treat all variables on the RHS as exogeneous, as you commented earlier:
"If you want the dynamics, you'll have to rewrite the model. For autoregressive models there should be a way to rewrite this in terms of the states (just as you can write an autoregression in terms of AR residuals)."
Could you give me any examples? I looked in the manual but couldn´t find any.
Thanks in advance.
Victor Naegele
- Attachments
-
- artigo or.wf1
- (33.57 KiB) Downloaded 331 times
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: State space out-of-sample forecast
There are lots of ways of doing something like this, all of which have slightly different dynamics. Here's one
Trubador could probably come up with a better one.
Code: Select all
@signal log_oil = sv1 + sv2*@trend + sv3
@state sv1 = c(6) + c(5)*sv1(-1) + [var = exp(c(3))]
@state sv2 = c(8)*sv2(-1) + [var = exp(c(6))]
@state sv3 = sv3(-1) + [var = exp(c(9))]
Re: State space out-of-sample forecast
Glenn is right, there are numerous ways to do that. For instance, you can also try an AR(2) model given the nature and the frequency of your dependent variable. You will find plenty of discussions on similar subjects if you search the forum. Start from here: http://forums.eviews.com/viewtopic.php?f=18&t=10029
Who is online
Users browsing this forum: No registered users and 2 guests
