Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: how to calculate cumulative number of organizations for stcox?


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: how to calculate cumulative number of organizations for stcox?
Date   Wed, 15 Jun 2011 22:55:03 +0100

Have a look at 

FAQ     . . . . . . . . . . . . . .  Calculating the number of distinct values
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        9/06    How do I calculate the number of distinct
                values seen so far?
                http://www.stata.com/support/faqs/data/distinctvalues.html

Nick 
n.j.cox@durham.ac.uk 

Caleb Southworth

My data include a continuous date and organizations. How can I
calculate the cumulative number of organizations in existence at time
t?

I could do this by year. My strategy at present it to calculate the
survival interval for h(t_i-t). I would like to calculate the number
of organizations in existence at the beginning of that interval.
Thanks!--Caleb

. stset date, id(id) fail(found==0)

                id:  id
     failure event:  found == 0
obs. time interval:  (date[_n-1], date]
 exit on or before:  failure

------------------------------------------------------------------------------
      621  total obs.
      565  obs. end on or before enter()
------------------------------------------------------------------------------
       56  obs. remaining, representing
       56  subjects
       18  failures in single failure-per-subject data
   212648  total analysis time at risk, at risk from t =         0
                             earliest observed entry t =         0
                                  last observed exit t =      8294

.
end of do-file

. stdes

         failure _d:  found == 0
   analysis time _t:  date
                 id:  id

                                   |-------------- per subject --------------|
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects               56
no. of records                56           1           1          1          1

(first) entry time                         0           0          0          0
(final) exit time                   3797.286           1       3925       8294

subjects with gap              0
time on gap if gap             0           .           .          .          .
time at risk              212648    3797.286           1       3925       8294

failures                      18    .3214286           0          0          1
------------------------------------------------------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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