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]

From |
John Ayers <john.ayers.sdsu@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Forecasting out of sample values for an autoregressive function.... |

Date |
Mon, 27 Jun 2011 14:24:38 -0400 |

Kit Baum replied to an earlier post where an autoregressive model was used to forecast out of sample...i.e. I want to predict an outcomes were an autoregressive function will likely produce the best forecasts but need to use the predicted values to produce latter predicted values (for 52 weeks). I ran the following, but this only gives me the prediction for one more week and not all 52 weeks. What am I doing wrong? Thanks very much inadvance for any suggestions. (usually when I get to the predict command, I get an error but rerun it and then get the results). tsappend,add(52) local switch = r(tmax) arima US L(1/4).US predict double UShat4 if tin(`switch',), dynamic(`switch') list date US UShat4 <> 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 -- Please don't forward this message to anyone else and treat all information as confidential or privileged. * * 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/

- Prev by Date:
**st: RE: testing equality of coefficients across two ivregress models** - Next by Date:
**re: st: Stata 12 Announcement** - Previous by thread:
**st: Reshape message - nn values will be changed** - Next by thread:
**re:st: Forecasting out of sample values for an autoregressive function....** - Index(es):