Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <mirko.moro@gmail.com>
To   statalist@hsphsun2.harvard.edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index