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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: data management question


From   千早 ケンジ <chihayakenji1893@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: data management question
Date   Thu, 1 Mar 2012 08:48:05 +0900

Hello Maria Cecilia

You cannot calculate the expected median time for such data using the normal procedures. You will probably have censoring in your data and it will be impossible to know which observation comes exactly in the middle, at the median. 

You may use survival analysis to estimate the survival probabilities and find the point where the probability is 0.5. That point T is the median survival time, and consequently the median time taking the pill uninterruptedly.

You -stset- your data using:

 stset day, id(id) failure(number_of_pills==0)

then you may use

 sts list

This will give the estimates of the survival function.

I hope this will help you.

Guilherme Kenji 

On 2012/03/01, at 8:14, Maria Cecilia Vieira da Silva wrote:

> Hello,
> My data set looks like below. Each patient (here patient 1 and 2) takes or not pills each day (from day 1 to day 12). I would like to estimate the median number of days that the patients take the pill uninterruptedly. For example, the median is 3 in the case below - Patient 1 (3, 4, 1) and Patient 2 (3, 2).
> Any suggestions about how to implement it in a large data set?
> I though about creating a dummy (number of pills>0) and performing sums for the series bordered by zeros, but I am not sure about a command that would allow me to create subseries defined as series of numbers bordered by zeros. Actually, if I could create such subseries, it would suffice to perform a count.
> Thanks,
> Maria Cecilia
> 
> 
> id day number of pills
> 1 1 1
> 1 2 2
> 1 3 1
> 1 4 0
> 1 5 0
> 1 6 2
> 1 7 1
> 1 8 2
> 1 9 3
> 1 10 0
> 1 11 0
> 1 12 1
> 2 1 0
> 2 2 0
> 2 3 0
> 2 4 1
> 2 5 1
> 2 6 1
> 2 7 0
> 2 8 0
> 2 9 0
> 2 10 2
> 2 11 2
> 2 12 0
> *
> *   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/


*
*   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