Re: [R] Age as time-scale in a cox model

2009-02-19 Thread Terry Therneau

You asked about survival curves with age scale versus follow-up scale.

 fit1 - coxph(Surv(time/365.25, status) ~ t5 + id + age, data=stanford2)
 surv1- survfit(fit1)
 surv1
  n  events  median 0.95LCL 0.95UCL 
157.000 102.000   1.999   0.898   3.608 

 summary(surv1, times=3)
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
3 46  850.451  0.04250.3750.543

  I've taken the liberty of rewriting your query using the standard survival 
library calls instead of Design, since I don't attempt to keep up with the 
latter.  The above shows a median survival of 1.999 years after enrollment, and 
a 3 year survival of 45%.  I was surprised when you put id in the model, but 
it turns out to have p=.03!  It seems that patients entered later in the study 
have better survival.
  
  Now for age scale:

 fit2 - coxph(Surv(age, age+ time/365.25, status) ~ t5 + id, stanford2)
 surv2- survfit(fit2)
 surv2
  n  events  median 0.95LCL 0.95UCL 
1.0   102.012.212.228.1 

This shows a median age at death of 12.2 years.  Puzzling, isn't it.

First, note that your code
  cph(Surv(age,age+time, status) ~ t5+id, data=stanford2...

doesn't make sense due to different time scales: age in years and time in days.

As to your final question:
These are obviously out-of sync, so there must be some way I can adjust them 
to 
mean the same thing. The first means the probability of surviving a 1000 days 
since they started being followed up while the second means the probability of 
surviving up to starting age+1000 days. How do I get the equivalent risks from 
the two models?

  The first fit is on a time since entry scale, and so the survival curve is 
with respect to time since entry.  The second is on an age scale, and so the 
curve will be in terms of absolute age, not starting age + x.  There is no 
simple way to realign them.
   As to the curve above with a median age of 12.2 years.  We know that a usual 
Kaplan-Meier curve can become unstable at the right hand end due to very small 
n 
(=5), which leads to big steps.  With start,stop data this can happen at the 
left end too.  In the stanford2 data set there is one subject who enters the 
study at age 12 and dies at age 12.2.  At the time of death there is only 1 
person at risk, so the survival curve goes to zero (100% death rate).  This 
curve is mathematically correct, but not at all useful.
   
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] Age as time-scale in a cox model-How to calculate x-time risk?

2009-02-18 Thread Eleni Rapsomaniki

Dear R users,

My question is more methodology related rather than specific to R usage. Using 
time on study as time in a cox model, eg:

library(Design)
stanf.cph1=cph(Surv(time, status) ~ t5+id+age, data=stanford2, surv=T)

#In this case the 1000-day survival probability would be:
stanf.surv1=survest(stanf.cph1, times=1000)

#Age in this case is a covariate. 

#I now want to compare the above estimate to the 1000-day survival probability 
I get using age at entry and exit as my time-scale:
stanf.cph2=cph(Surv(age,age+time, status) ~ t5+id, data=stanford2, surv=T)
stanf.surv2=survest(stanf.cph2, times=1000)

summary(stanf.surv1$surv)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.NA's 
 0.1131  0.3370  0.4669  0.4538  0.5633  0.7480 27. 
 summary(stanf.surv2$surv)
Min.  1st Qu.   Median Mean  3rd Qu. Max. NA's 
 0.07387  0.23240  0.35770  0.35370  0.46820  0.60650 27.0 

These are obviously out-of sync, so there must be some way I can adjust them to 
mean the same thing. The first means the probability of surviving a 1000 days 
since they started being followed up while the second means the probability of 
surviving up to starting age+1000 days. How do I get the equivalent risks from 
the two models?

Any tips greatly appreciated!!

(FYI A related entry to my question can be found at:
http://tolstoy.newcastle.edu.au/R/e2/help/07/02/9831.html)

Eleni Rapsomaniki
 
Research Associate
Department of Public Health and Primary Care
University of Cambridge


 




[[alternative HTML version deleted]]

__
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.