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

st: Re: dynamic forecasts

From   Christopher F Baum <[email protected]>
To   [email protected]
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

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, under Stata Users Group) and look at You can do that via ssc type, but it helps to read the surrounding text.


* For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index