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]

Re: st: Out-of-sample forecasting using OLS regression

From   Edin Zoronjic <>
Subject   Re: st: Out-of-sample forecasting using OLS regression
Date   Tue, 21 Aug 2012 01:50:46 +0100

Thank you very much for your answers, I appreciate your willingness to help me.

I will try to clarify what I am doing:

I do dynamic factor model as it follows:

First of all I generate factors using factor analysis function which
is available in Stata.
Secondly, I save two factors in my data set as new variables.
Thirdly, I run following regression (ARIMA or OLS):

cpi = c + l.cpi + factor1 + factor2,

When I do in-sample forecast, Stata generates predicted values for t-1
observations. However, when I expand the data set and do out-of-sample
forecast, Stata does not generate any values.

When I am doing simple ARIMA forecast (regressing dependent variable
on its lags), Stata generates predicted values for t+h-1 value (where
"h" is the period of forecast).

There are no missing values in my data set for all the variables I
include (cpi, factor1, factor2).

I am really sorry for disturbing you one more time.

Thank you in advance.

Best regards,


On 21 August 2012 00:36, Christopher Baum <> wrote:
> <>
> Edin said
> I am currently working on my master thesis which is focused on the Dynamic
> factor model forecasting.
> Unfortunately, I got stuck at the out-of-sample forecasting. After running
> OLS regression when I try to do out-of-sample forecast, Stata generates the
> missing values for all the observations.
> 2011m12 is the last observation in my sample, afterward data set was
> expanded.  I am using following command after running regression:
> predict pcpi if t>tm(2011m12)
> I would really appreciate if somebody could tell me what the potential
> source of this problem is and how I could solve it.
> I am confused by the mention of 'dynamic factor model', as there are such models (-dfactor-) in Stata. But I think what Edin
> means is that he wants to do out-of-sample dynamic forecasting from a plain OLS regression. This can (currently only) be done with -arima-,
> which despite its name can estimate OLS regressions, and can generate dynamic forecasts (help arima postestikmation) from a model
> such as y_t = b0 + b_1 y_t-1 + x_t + epsilon_t. As Nick Cox points out, you must have values of x_t defined during the ex ante forecast 'period.
> But in a dynamic forecast, you need not have values of y_t-1 beyond the estimation sample.
> Kit
> Kit Baum   |   Boston College Economics & DIW Berlin   |
>                              An Introduction to Stata Programming  |
>   An Introduction to Modern Econometrics Using Stata  |
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

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