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

st: How to calculate fitted values from dynamic models

From   "Rio, Martin" <[email protected]>
To   [email protected]
Subject   st: How to calculate fitted values from dynamic models
Date   Tue, 3 Aug 2004 14:12:47 -0400

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.

Mart´┐Żn Rio
Charles River Associates
Washington, DC 
202.662.3957 (phone)
202.662.3910 (fax)
> ___________________________________________________
> This electronic message contains information from the consulting firm of
> Charles River Associates Inc., which may be confidential or privileged.
> The
> information is intended for the use of the individual or entity named
> above.
> If you are not the intended recipient, be aware that any disclosure,
> copying,
> distribution or use of the contents of this information is prohibited.  If
> you
> have received this electronic transmission in error, please notify us  by
> telephone (617 425-3582) or by e-mail ([email protected]) immediately.

*   For searches and help try:

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