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 15:10:43 +0100

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/



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