Re: [R] Function Surv and interpretation

2009-05-18 Thread Terry Therneau
Dr Pearce,
 
  1. The heart of your question is why Surv(time, death) works, when the 
standard S action would be to match death to the time2 argument.
   The answer is that Surv is not conventional -- if only 2 unnamed arguments 
are present, then it assumes that they match to the time and event arguments.  
At least in my work, 99% of the uses of survival are either (time1, time2, 
status) or (time, status); so the function was made convenient for the most 
common case.
   
   2. Q2: why did Surv(time, event=death) give an error message?  This was a 
programming error which has been corrected in the most recent version of the 
code.
   
   3. I'm not familiar with the details of the cuminc function (I assume from 
the cmprsk package).  However, with the newest version of survival you can use 
the alternative:
fit - survfit(Surv(ftime, fstatus0) ~ group, event=fstatus, data=mydata)

The result is a standard survival curve object, so all of the usual plotting 
methods for survival curves work, e.g.,
plot(fit[1:3], fun='event', col=c(2,7,5), lty=c(1,2,2))

In the survfit formulation 'status' is still 0/1 for censored/uncensored, and 
'event' gives the event type for the deaths.  The event code for the censors is 
ignored and can be any value (but don't use NA - that will cause the 
observation 
to be dropped).

Terry Therneau

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Function Surv and interpretation

2009-05-15 Thread K F Pearce


Dear everyone,

My question involves the use of the survival object.

We can have 

Surv(time,time2,event, type=, origin = 0)   
(1)

As detailed on p.65 of:

http://cran.r-project.org/web/packages/survival/survival.pdf


My data (used in my study) is 'right censored'  i.e. my variable corresponding 
to 'event' indicates whether a person is alive (0) or dead (1) at date last 
seen  and my 'time'  indicates time from transplant to date of last contact 
(where this is time from transplant to death if person has died or time from 
transplant to date last seen if person is still alive).

Now I am using function, rcorr.cens

http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/rcorr.cens.html

This function involves use of Surv.

Now here is a section of my syntax:


 time-data$ovsrecod
 x1-data$RMY.GROUPS
 death-data$death
 rcorr.cens(x1,Surv(time,death),outx=FALSE)
 (2)

As you can see, I have entered Surv(time,death)...this works (and complies with 
the example given in R for rcorr.cens) and all seems to be well...however, 
bearing in mind that in (1) we have:

Surv(time,time2,event, type=, origin = 0)

...how does R know that 'death' in *my* syntax (2) is the 'event'...i.e. how 
does it know that time2 is skipped in my analysis?  I am a bit perplexed!  The 
R documentation for Surv says that  Surv(time,event) is a 'typical usage' as is 
Surv(time,time2,event, type=, origin = 0)...but how does it know when we are 
using the former and not the latter?  I have tried entering:  
rcorr.cens(x1,Surv(time,event=death),outx=FALSE) but it does not like it saying 
that Error in Surv(time, event = death) : argument time2 is missing, with no 
default

I hope that this makes sense!

Thank you so much for your advice on this ...it's much appreciated, Kim
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.