I would appreciate some help forecasting an ECM model. The equation I'm trying to forecast is a traditional ECB equation:
f2 = beta(1)*f2(-1) - beta(2)*(f2_level(-1)-beta(3)*oil(-1) - beta(4)*comm_agriculture(-1)-beta(5)*comm_metals(-1)),
whereby f2 is the series in first differences and f2_level the series in levels. The attached workfile contains all series.
Here's the code to set up the basic framework:
Code: Select all
coef(5) beta
series f2_level = @cumsum(f2)
' Test the cointegration relationship -- first the LR relationship, then the SR relationship
smpl 1980q1 2007q4
equation eq_lr.ls f2_level = c(1)*oil - c(2)*comm_agriculture-c(3)*comm_metals
equation eq_ecm.ls(n) f2=beta(1)*f2(-1) -beta(2)*(f2_level(-1) -beta(3)*oil(-1) - beta(4)*comm_agriculture(-1)-beta(5)*comm_metals(-1))
fit f2_hat
plot f2_level @cumsum(f2_hat)
' Forecasting
' Build a model
model model_test
model_test.merge eq_lr
model_test.merge eq_ecm
In other words, I'm first generating f2_levels, then test the cointegration relationship, then estimate the ECM (don't look too hard on the econometrics; I'm just using this data as illustration).
Then, however, I run into difficulties as I'm trying to cast this in model form. I think I need to make explicit to the model that f2=d(f2_level), but if I try adding this equation, I get the error message that "f2 is specified as endogenous in another equation" (not surprising). So I'm a bit at a loss how to accomplish this.
Any advice would be greatly appreciated!
Many thanks, Philipp