[R] Function Surv and interpretation
K F Pearce
k.f.pearce at newcastle.ac.uk
Fri May 15 16:31:44 CEST 2009
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
More information about the R-help
mailing list