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: out-of-sample prediction does not work after -regress- with lags


From   Mirko <[email protected]>
To   [email protected]
Subject   st: out-of-sample prediction does not work after -regress- with lags
Date   Wed, 4 May 2011 12:24:20 +0100

Dear Statalisters,

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?

Thanks
Mirko




________________________________________
From: Mirko Moro
Sent: 03 May 2011 16:00
To: Alberto Montagnoli
Subject:

use http://www.stata-press.com/data/r11/tsappend1
regress y l.y
mat b = e(b)
mat colnames b = L.xb one
tsappend, add(12)
predict xb if t2<=tm(2000m2)
gen one=1
mat score xb=b if t2>=tm(2000m2), replace

pag. 291 manuale

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