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

Re: st: assignment by indexing


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: assignment by indexing
Date   Wed, 4 Feb 2004 07:58:23 -0500

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
[email protected]

----- Original Message ----- 
From: "Ben Pelzer" <[email protected]>
To: <[email protected]>
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/



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