Bookmark and Share

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

[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 <>
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:

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:

tsset year, yearly
regress  unem
tsappend, add(4)
predict unem_hat
(option xb assumed; fitted values)

Could anybody explain why this is?


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

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:

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