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

Re: st: stsplit and cumulative dose


From   Michael Hills <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: stsplit and cumulative dose
Date   25 Apr 2004 09:49:51 +0100

Enzo,

Thanks for the suggestion. Your code works perfectly on the data
provided, but unfortunately occupational studies often include follow-up
without an increase in cumulative does. When xin=xout using stsplit with
x as the time scale does not work, because records with xin=xout are
rejected. I should have included this in my test data.

I bodged the code by adding 0.00001 to xout when xin=xout, and then
removing it later, but it adds up to rather a messy solution,
particularly when xout corresponds to one of the break points for
ecxposure group.

But at least its a start, and I ma grateful for your help,

Michael

On Fri, 2004-04-23 at 14:17, Enzo Coviello wrote:
> At 12.33 22/04/04 +0100, you wrote:
> >Using stlexis (stata 5) I used to be able to split follow-up time
> >according to cumulative dose (x) of some exposure.
> >
> >For example, I could convert these three records
> >
> >  id   timein   timeout   xin   xout   fail
> >-------------------------------------------
> >   1        0         5     0     40      0
> >   1        5        10    40    180      0
> >   1       10        15   180    220      1
> >
> >into these five records
> >
> >     id   timein   timeout   fail   exp_grp
> >      1    0.000     5.000     0     0-100
> >      1    5.000     7.143     0     0-100
> >      1    7.143    10.000     0   100-200
> >      1   10.000    12.500     0   100-200
> >      1   12.500    15.000     1   200-300
> >
> >making the assumption of a linear increase in cumulative dose between
> >readings.
> >
> >Somewhere along the line the contributed command stlexis was replaced by
> >the official command stsplit, but I can't figure out how to do this with
> >stsplit. Even worse, I can't figure out how to do it at all without going 
> >back to stlexis.
> 
> 
> Dear prof Hills,
> 
> maybe this could an empirical solution:
> 
> . gen xoutcopy=xout
> 
> . stset xout,enter(xin) id(id) f(fail)
> 
> 
> . stsplit exposure, at(100 200)
> (2 observations (episodes) created)
> 
> . bysort id (xout) : replace timeout = timein+ (timeout-timein) * (_t-_t0) 
> / (xoutcopy-_t0)
> 
> . bysort id (_t) : replace timein=timeout[_n-1] if _n>1
> 
> . stset timeout,enter(timein) id(id) f(fail)
> 
> . list  id timein timeout xin xout exposure
> 
>       +------------------------------------------------+
>       | id    timein   timeout   xin   xout   exposure |
>       |------------------------------------------------|
>    1. |  1         0         5     0     40          0 |
>    2. |  1         5   7.14286    40    100          0 |
>    3. |  1   7.14286        10    40    180        100 |
>    4. |  1        10      12.5   180    200        100 |
>    5. |  1      12.5        15   180    220        200 |
>       +------------------------------------------------+
> 
> 
> Enzo
> 
> 
> 
> ^^^^^^^^^^^^^^^^
> Enzo Coviello
> Dipartimento di Prevenzione ASL BA/1
> via L. Barbera 27 - 70055 MINERVINO MURGE (BA)
> Italy
> tel - fax +39 0883 691053
> tel (home) +39 0883 695055  
> 
> *
> *   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/
> 
> 


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