Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Perron Benoît <benoit.perron@umontreal.ca> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: Multi-step forecasts |
Date | Sun, 21 Mar 2010 20:26:49 -0400 |
Dear all, I would like to compute multi-step forecasts and forecast errors in a pseudo-out of sample experiment to valuate forecast accuracy (for example by running a Diebold-Mariano (1995) test with dmariano from ssc). For example, I have quarterly data of a variable called lstarts and I want to compare forecast accuracy 1 year ahead (so forecast horizon is 4 periods). The Where I am having problems is in generating these forecasts. Has anyone done this before? In case no one has done this, here is what I have tried. Inside a loop that determines the window of the estimation sample (from 1 to 101, then 1 to 102, etc.) , after the ARMA command, one has to use the predict command with the dynamic option. The program should look something like: forvalues p = 101(1)172 { * ARMA(1,4) arima lstarts in 1/`p' , ar(1) ma(1/4) * forecasts drop yhat4c predict yhat4c, dynamic(`p'+1) } I now need a way to keep the value of the forecast for period p+4. One way I found is to transform the forecast series into a matrix and pick the right element, and when the loop is done, convert the matrix thus obtained back to a series, for example, by including inside the above loop: mkmat yhat4c, matrix(fore) mat fore4c[`p'+4,1] = el(fore,`p'+4,1) and the convert to a series by svmat fore4c, names(fore4c1) Stata accepts all this, but somehow, this does not give me the appropriate results. One way of checking this is by looking at one-step ahead. I get different forecasts with this approach than using the predict option without the dynamic option. This gives me a set of one-step ahead forecasts that are quite different from those I get with this approach. I am sure that there must be much more straightforward way of doing this. Or maybe someone can figure out where things go wrong? Thanks for any help, Benoit * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/