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]

st: How to predict out of sample using OLS regression with lagged values


From   Li CHANG <[email protected]>
To   [email protected]
Subject   st: How to predict out of sample using OLS regression with lagged values
Date   Mon, 04 Jul 2011 18:40:26 -0400

Dear all:

I have a question about out of sample forecast using OLS regression with lagged values. I run the regression as follows:

I have a dataset of 169 observations:
. tsset t
. reg lnord t i.week L(1/52).lnord, noconstant

I then try to forecast 39 out-of-sample data after:

.tsappend, add(39)

I also recode to fill in the missing value in "week" variable. But it only give one-step-ahead forecast (stops after generating the 170th value), because I guess there is no lag value when stata tries to use for predicting the 171st observation.

I am wondering is there code to call STATA to use the predicted 170th observation to for the 171st value, something like a loop?

Thank you!

Regards,
Li Chang
*
*   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