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

st: recursively defined variables


From   bpersson@bu.edu
To   statalist@hsphsun2.harvard.edu
Subject   st: recursively defined variables
Date   Thu, 15 Sep 2005 12:58:11 -0400

Dear Statalist,

I was wondering if anybody could help me to define a variable
recursively in stata? That is, I would like define each observation x
as the sum of a flow variable, z, and the lagged x variable,
discounted by a factor b:

xt = zt + b*xt-1

The three first x variables would then be:

x1 = z1

x2 = z2 + b*z1

x3 = z3 + b*z2 + b^2*z1

and so on).

I appreciate your help,

Best Regards
BP



*
*   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