Hi,
I am investigating the predictive abilities of macrovariables on stock market returns. So far I have made 1-step ahead predictions from single equation models, keeping the starting point fixed and for each new regression extending the dataset by one observation. I would like to compare the single equation forecasts with forecasts from a system of equations such as a vector error correction model and a VAR. I have used the following program for my forecasts:
gen time = _n
tsset time
capture program drop rforecast
program rforecast, rclass
syntax [if]
regress dose l.dose dnib `if'
summ time if e(sample)
local last = r(max)
local fcast = _b[_cons] + _b[L.dose]*dose[`last']///
+ _b[dnib]*nib[`last'+1]
return scalar forecast = `fcast'
return scalar actual = dose[`last' +1]
end
rolling actual=r(actual) forecast=r(forecast), recursive ///
window(149) saving(myrolling, replace): rforecast
use myrolling, clear
list in 1/100
Hopefully, the program will work on a VECM by substituting the sentences in bold. How should I modify my program to do rolling window estimation/forecasting using a VECM? I suppose the number of cointegrating vectors and lags would have to be fixed.
Sincerely
Svein Lauvsnes
Bodoe Graduate School of Business, Norway
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/