[R] survfit using quantiles to group age

Frank E Harrell Jr f.harrell at vanderbilt.edu
Mon Feb 2 20:32:42 CET 2009


Eleni Rapsomaniki wrote:
> I am using the package Design for survival analysis. I want to plot a 
> simple Kaplan-Meier fit of survival vs. age, with age grouped as 
> quantiles. I can do this:
> 
> survplot(survfit(Surv(time,status) ~ cut(age,3), data=veteran)
> 
> but I would like to do something like this:
> 
> survplot(survfit(Surv(time,status) ~ quantile(age,3), data=veteran) 
> #will not work
> 
> ideally I would like to superimpose estimates from cph models, which 
> automatically fit the 2nd to 4rth quantiles for age, so I need the age 
> groups to be grouped the same.
> 
> Any help greatly appreciated!
> Eleni Rapsomaniki

This will result in a poor fitting model and residual confounding (by 
only partially adjusting for a variable; you are assuming a piecewise 
flat model).  Use Surv( ) ~ strat(cut2(age,g=3)) ...
For Design it is often better to do

ageg <- cut2(age,g=3)   # Donald Rumsfeld approach to using information
f <- cph(Surv( ) ~ strat(ageg), ...)

Frank

> 
-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list