[R] Re: [S] plot of survival probability vs. covariate

Frank E Harrell Jr feh3k at spamcop.net
Fri Dec 12 02:35:37 CET 2003


On Thu, 11 Dec 2003 15:23:37 -0800 (PST)
array chip <arrayprofile at yahoo.com> wrote:

> Hi everyone,
> 
> I am fitting a cox proportional hazard model with a
> continuous variable "x" as the covariate:
> 
> fit<-coxph(Surv(time, status)~x)
> 
> Now I wanted to make a plot of survival probability
> vs. the covariate, and the 95% confidence interval for
> the survival probability. It's just like a
> Kaplan-Meier Survival curve, except now the x axis
> represents the value of covariate, not the time.
> Someone gave me a reference to a paper in JASA by Gary
> (1992) for this type of plot, but I didn't have the
> access to the paper. So I am wondering if anyone knows
> how to do this in R or S-Plus?

This will get you started.  Look into the documentation for confidence
limits.

library(Design)  # if S-Plus do  library(Hmisc,T);library(Design,T)
dd <- datadist(yourdataframe)
options(datadist='dd')
f <- cph(Surv( ) ~ x1+x2, surv=T, x=T, y=T)
plot(f, x1=NA, time=2)  # plots 2-year survival

Frank Harrell

> 
> In addition, can anyone explain to me what are the
> following "type" options in predict.coxph()
> predicting?
> 
> predict(fit,type='lp',se.fit=T)
> predict(fit,type='risk',se.fit=T)
> predict(fit,type='expected',se.fit=T)
> predict(fit,type='terms',se.fit=T)
> 
> 
> Thank you very much
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> --------------------------------------------------------------------
> This message was distributed by s-news at lists.biostat.wustl.edu.  To
> ...(s-news.. clipped)...



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




More information about the R-help mailing list