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

RE: st: assignment by indexing


From   "Ben Pelzer" <[email protected]>
To   <[email protected]>
Subject   RE: st: assignment by indexing
Date   Wed, 4 Feb 2004 13:40:42 +0100

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/



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