Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: out-of-sample prediction does not work after -regress- with lags


From   Christopher Baum <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: out-of-sample prediction does not work after -regress- with lags
Date   Thu, 5 May 2011 07:06:09 -0400

<>
On May 5, 2011, at 2:33 AM, Mike wrote:

> I cannot get out-of-sample forecasting after a regression with lags:
> 
> use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
> tsset year, yearly
> regress  unem l(1/6). unem
> tsappend, add(5)
> predict unem_hat
> 
> This gives:
> "(option xb assumed; fitted values)
> (9 missing values generated)"
> 
> According to the manual, "-predict- can be used to make in-sample or
> out-of-sample predictions:
> 6. predict calculates the requested statistic for all possible
> observations, whether they were used in fitting the model or not."
> 
> However from the example above only one out of sample data is predicted.
> 
> Out-of-sample prediction does work when lags are not included:
> 
> use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
> tsset year, yearly
> regress  unem
> tsappend, add(4)
> predict unem_hat
> (option xb assumed; fitted values)
> 
> 
> Could anybody explain why this is?

In the latter 'regression' you are predicting a constant, and you can do that for as many future periods as you want. If the equation is an autoregression, and you want true ex ante predictions (that is, you do not know what the depvar is during those periods), you must use a dynamic forecast:

clear all
use http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS
tsset year,yearly
loc switch = r(tmax)
tsappend,add(8)
arima unem L(1/4).unem
predict double unemhat if tin(`switch',), dynamic(`switch')

When you get far enough out of sample, the RHS values of lagged unem will be those predicted by the model in earlier periods.

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html




*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index