Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: dynamic forecasts


From   Christopher F Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: dynamic forecasts
Date   Wed, 4 Aug 2004 09:05:40 -0400

On Aug 4, 2004, at 2:33 AM, Martin wrote:

Dear Stata users,

I am trying to calculate fitted values from a very simple dynamic model, in
this case one with a lagged dependent variable. The model is:

x[t] = a*x[t-1] +b*y[t] + u[t], for t >= 1

I first create the variable 'x1' which is the lagged value of x, and then
run:

reg x x1 y

Now I want to create the fitted values from this regression. The command
'predict xhat', would simply calculate:

xhat[t] = a*x1[t] + b*y[t] for t >= 1, which is not dynamic.

The equation I should be using is:

xhat[t] = a*x1[t] + b*y[t]), for t = 2 and
xhat[t] = a*xhat[t-1] + b*y[t], for t > 2

Does anyone know of a simple way of doing this in Stata? I realize I could
write a loop that calculates xhat observation by observation using the
parameters from the estimation, but that is a hassle when I have to run many
different specifications. I'm hoping Stata has a command similar to
'predict' that calculates the fitted values in simple dynamic models like
the one in this example. Any help will be appreciated.

Please read my London SUG talk (available in IDEAS, http://ideas.repec.org under Stata Users Group) and look at arima_X.do. You can do that via ssc type arima_X.do, but it helps to read the surrounding text.

Kit

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index