I think you should check out stata's indexing more thoroughly before
dismissing it, in particular, constructs such as x[_n-1] , which refer to
the prior observation all across the data set without the need for a
separate index variable. I don't know exactly what you're trying to do, but
I can't imagine that you really need 107 separate equation to refer to prior
observations.
Michael Blasnik
michael.blasnik@verizon.net
----- Original Message -----
From: "Ben Pelzer" <b.pelzer@maw.kun.nl>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, February 04, 2004 7:40 AM
Subject: RE: st: assignment by indexing
> Nick, Ernest and Allan,
>
> Thanks for your comments and tips. I am surprised that a statement like
"gen
> newvar = x(indexvar)" is not available in Stata, since in other packages,
> this is everyday meat. In my application, the indexvariable is "time"
which
> is used in a Markov model that links state probabilities a timepoint t to
> those at t-1 and to the transition probabilities to "stay in 1" or to
> "switch from 0 to 1", i.e.:
>
> p(y=1|time) = p(y=1|time-1) * p(stay in 1) + p(y=0|time-1) *
> p(switch from 0 to 1)
>
> This equation is to be evaluated for 107 timepoints, so using time as an
> index, would be very handsome. In the past I implemented the model in
> several other packages, (which I dare not mention here), and I now would
> like to develop a Stata version as well. In Stata I suppose I have to use
> 107 equations, then? Ok, if that's all it takes, I'll go for it. Thanks
> again, Ben.
>
*
* 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/