Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
ulio Glogowsky <ulioglogowsky@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: recursive variable |

Date |
Fri, 31 Aug 2012 11:15:49 +0200 |

Dear Statalist, I am trying to create two variables which are dependent on its lagged values and on a lagged value of a second variable: y = b1*y(t-1)+b2*x(t-1)+u x = b1*x(t-1)+b2x(t-1)+u I am familiar with the 'one variable solution' posted by Nick Cox, as well as with the paper by Roger Newson's useful Stata Tip in Stata Journal 4(4) 2004: //tsset group time //gen x = y //replace x = constant * L.x //gen x = y //bysort group (time): replace x = constant * x[_n-1] if _n > 2 If anyone has an idea on how to do this with more than 1 variable, I would be most grateful. In addition I'm trying to generalize the solution to the 'variable lag case'. For this purpose I would like to use coefficient vectors and lists: Illustrative Example gen local `list' "y(t-1) x(t-1)" B = (b1, b2) replace y = B'* `list' +U Would it be possible to multiply vectors with variable lists (e.g. in Mata?)? Thanks Uli * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: recursive variable***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: RE: Mean test in a Likert Scale** - Next by Date:
**Re: st: stepwise - how to get list of names of variables selected?** - Previous by thread:
**st: stepwise - how to get list of names of variables selected?** - Next by thread:
**Re: st: recursive variable** - Index(es):