Eleni Rapsomaniki
2009-Feb-25 15:07 UTC
[R] C-index for models fitted using start, stop in Surv?
Dear R-users, One can use the rcorr.cens function in Design to compute the C index when only the stop time is indicated (I think implicitely start=0 in that case). When the start and stop times are used in a Surv object, e.g. library(Design) S=with(heart, Surv(start,stop,event)) the object returned is no longer a single number vector, so none of the following ways to compare a model fit to S makes sense: rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors, with(heart, Surv(start,stop,event))) # C Index Dxy S.D. n missing # 4.95e-01 -9.66e-03 7.15e-02 1.72e+02 0.00e+00 #this seems bad because it compares the fit to a different Surv than the one used to fit it (S, above) rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors, with(heart, Surv(stop-start,event))) # C Index Dxy S.D. n missing # 6.02e-01 2.03e-01 7.54e-02 1.72e+02 0.00e+00 Is there some way I can compute the correlation for this type of survival time specification in R? If not, does anybody have some tips on how to go about computing it myself? Many Thanks Eleni Rapsomaniki Research Associate Strangeways Research Laboratory Department of Public Health and Primary Care University of Cambridge ?
Frank E Harrell Jr
2009-Feb-25 17:50 UTC
[R] C-index for models fitted using start, stop in Surv?
Eleni Rapsomaniki wrote:> Dear R-users, > > One can use the rcorr.cens function in Design to compute the C index when only the stop time is indicated (I think implicitely start=0 in that case). When the start and stop times are used in a Surv object, e.g. > > library(Design) > S=with(heart, Surv(start,stop,event)) > > the object returned is no longer a single number vector, so none of the following ways to compare a model fit to S makes sense: > > rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors, with(heart, Surv(start,stop,event))) > # C Index Dxy S.D. n missing > # 4.95e-01 -9.66e-03 7.15e-02 1.72e+02 0.00e+00 > #this seems bad because it compares the fit to a different Surv than the one used to fit it (S, above) > > rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors, with(heart, Surv(stop-start,event))) > # C Index Dxy S.D. n missing > # 6.02e-01 2.03e-01 7.54e-02 1.72e+02 0.00e+00 > > Is there some way I can compute the correlation for this type of survival time specification in R? If not, does anybody have some tips on how to go about computing it myself? > > Many Thanks > > Eleni Rapsomaniki > Research Associate > Strangeways Research Laboratory > Department of Public Health and Primary Care > University of Cambridge > >rcorr.cens is not meant for that. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Eleni Rapsomaniki
2009-Feb-25 18:34 UTC
[R] C-index for models fitted using start, stop in Surv?
> rcorr.cens is not meant for that.Thank you for the clarification. On a second thought, I think (hope) a time-dependent AUC index should be more appropriate in this case, such as survivalROC. Many many thanks for all your help! Eleni Rapsomaniki Research Associate Tel: +44 (0) 1223 740273 Strangeways Research Laboratory Department of Public Health and Primary Care University of Cambridge -----Original Message----- From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu] Sent: 25 February 2009 17:50 To: Eleni Rapsomaniki Cc: r-help at r-project.org Subject: Re: [R] C-index for models fitted using start, stop in Surv? Eleni Rapsomaniki wrote:> Dear R-users, > > One can use the rcorr.cens function in Design to compute the C indexwhen only the stop time is indicated (I think implicitely start=0 in that case). When the start and stop times are used in a Surv object, e.g.> > library(Design) > S=with(heart, Surv(start,stop,event)) > > the object returned is no longer a single number vector, so none ofthe following ways to compare a model fit to S makes sense:> > rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors,with(heart, Surv(start,stop,event)))> # C Index Dxy S.D. nmissing> # 4.95e-01 -9.66e-03 7.15e-02 1.72e+020.00e+00> #this seems bad because it compares the fit to a different Surv thanthe one used to fit it (S, above)> > rcorr.cens(-cph(S~ age+transplant+surgery, heart)$linear.predictors,with(heart, Surv(stop-start,event)))> # C Index Dxy S.D. nmissing> # 6.02e-01 2.03e-01 7.54e-02 1.72e+020.00e+00> > Is there some way I can compute the correlation for this type ofsurvival time specification in R? If not, does anybody have some tips on how to go about computing it myself?> > Many Thanks > > Eleni Rapsomaniki > Research Associate > Strangeways Research Laboratory > Department of Public Health and Primary Care > University of Cambridge > >rcorr.cens is not meant for that. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Terry Therneau
2009-Feb-26 14:00 UTC
[R] C-index for models fitted using start, stop in Surv?
One of my colleagues has written a technical report on how to do this, but I have not yet implemented it in the survival package. Terry Therneau http://mayoresearch.mayo.edu/mayo/research/biostat/techreports.cfm #80 Concordance for Survival Time Data: Fixed and Time-Dependent Covariates and Possible Ties in Predictor and Time Concordance, or synonymously the C-statistic, is a valuable measure of model discrimination in analyses involving survival time data. This report provides a definition of concordance in the case of survival data, allowing for time-dependent covariates with the counting process data representation and accounting for ties in the covariates and times. Walter K Kremers and The William J. von Liebig Transplant Center [April 2007]