[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Michael Blasnik" <michael.blasnik@verizon.net> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: assignment by indexing |

Date |
Wed, 4 Feb 2004 11:19:37 -0500 |

if p1, p2, etc.. just represent the same quantities at different times, I'm not sure why you don't reshape long? reshape long p, i(idvar) j(time) then all your statements could be done in 2 steps: replace p=invlogit(`lgtp1' ) in 1 replace p=p[_n-1]*`ka'+(1-p[_n-1])*`mu' in 2/l 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 9:10 AM Subject: RE: st: assignment by indexing > Nick, > > Your answer yesterday was clear. I was looking for a neat way to solve the > problem, but finally decided to use the following set of commands for a > similar, yet smaller, problem of only 13 timepoints: > > quietly replace `p1' = invlogit(`lgtp1'); > quietly replace `p2' = `p1' * `ka' + (1-`p1' ) * `mu' > quietly replace `p3' = `p2' * `ka' + (1-`p2' ) * `mu' > quietly replace `p4' = `p3' * `ka' + (1-`p3' ) * `mu' > quietly replace `p5' = `p4' * `ka' + (1-`p4' ) * `mu' > quietly replace `p6' = `p5' * `ka' + (1-`p5' ) * `mu' > quietly replace `p7' = `p6' * `ka' + (1-`p6' ) * `mu' > quietly replace `p8' = `p7' * `ka' + (1-`p7' ) * `mu' > quietly replace `p9' = `p8' * `ka' + (1-`p8' ) * `mu' > quietly replace `p10' = `p9' * `ka' + (1-`p9' ) * `mu' > quietly replace `p11' = `p10' * `ka' + (1-`p10' ) * `mu' > quietly replace `p12' = `p11' * `ka' + (1-`p11' ) * `mu' > quietly replace `p13' = `p12' * `ka' + (1-`p12' ) * `mu' > > Here, ka and mu are the transition probs. Of course, following your > matrix-suggestion would solve all problems but also cause some extra work, > while copying statements is very fast... I didn't know the 'egen' statement, > so, I'll have a look at it right away. 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/

**References**:**RE: st: assignment by indexing***From:*"Ben Pelzer" <b.pelzer@maw.kun.nl>

- Prev by Date:
**re: Re: st: Extremely poor performance in repeated ANOVA** - Next by Date:
**st: Single decrement period life tables** - Previous by thread:
**RE: st: assignment by indexing** - Next by thread:
**RE: st: assignment by indexing** - Index(es):

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