Statalist The Stata Listserver


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

st: RE: RE: RE: RE: RE: RE: RE: Excluding Observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: RE: RE: RE: Excluding Observations
Date   Mon, 15 May 2006 23:41:54 +0100

Nothing personal here.  

As you say, it is for Raphael Fraser to say
what he wants, and he has, I think, indicated
that the code offered solves his problem. 

Nick 
[email protected] 

[email protected]
 
> Well
> 1) I think the data are about medical treatment (dov == 1), 
> but I might
> be wrong
> 2) I also thought that he is probably intersted in some short-term
> effects, that is why he wants to exclude obs with a visit past 90 days
> after traetment, but I might be wrong again
> 
> Don't take my suggestions too personally - it is not meant that way. 
> It is probably best the researcher himself decides ( where is 
> he ?) what
> he needs.
 
Nick Cox
 
> We are at cross-purposes here. I don't
> know what you mean by "treatment". There is no reference to 
> treatment in
> the problem. 
> 
> I believe that I have solved this problem with code that will 
> work. Very
> likely Alex Ogan's solution is equivalent, although
> -drop- is a rather extreme interpretation of "excluding 
> observations". 
> 
> You should show that my solution is wrong, if you think it is. 
> 
> Or you could suggest another one, if
> you can think of one that is better or
> interesting from another point of view.
 
[email protected]
  
> > I meant the accumulated time after visit with treatment.
> > He does not have that yet. The  he will also have obs with dov == 1 
> > and 90 days after treatment
>  
> Nick Cox
>  
> > No. He already has that. You must use
> > the data on transfusions. 
>  
> [email protected]
>   
> > > It looks like to me he has to construct a time variable that 
> > > accumulates the number of days since last visit
>  
> Nick Cox
>   
> > > A visit results in a transfusion whenever t is 1. 
> > > 
> > > gen ttime = dov if t == 1
> > > 
> > > This results in missings whenever t is 0. 
> > > Hence we fill in missings following the usual cascade principle 
> > > documented at http://www.stata.com/support/faqs/data/missing.html
> > > 
> > > bysort id (dov): replace ttime = ttime[_n-1] if mi(ttime)
> > > 
> > > Here I am assuming that you want each patient treated separately. 
> > > 
> > > Then the time since the last transfusion is simply
> > > 
> > > gen sincettime = dov - ttime
> > > 
> > > Then you can exclude whatever you want. You have to work
> > out what to
> > > do with observations before the first transfusion (on record).
> > > 
> > > -etime- is superfluous here. 
> > > 
> > > Nick
> > > [email protected]
> > > 
> > > Raphael Fraser
> > >  
> > > > I would like to exclude from my data set all observations
> > up to 90
> > > > days AFTER a transfusion (i.e. t = 1). The variable etime
> > > is the  time
> > > 
> > > > elapse since last visit. Can any one help?
> > > > 
> > > >          id         dov   t   etime
> > > >      57   26apr1977   0      57
> > > >      57   27apr1977   0       1
> > > >      57   28jun1977   0      62
> > > >      57   27jul1977   0      29
> > > >      57   19aug1977   1      23
> > > >      57   12sep1977   0      24
> 

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