[R] plot(survfit(fitCox)) graph shows one line - should show two

John Sorkin jsorkin at grecc.umaryland.edu
Sun May 10 23:43:24 CEST 2009

R 2.8.1
Windows XP

I am trying to plot the results of a coxph using plot(survfit()). The plot should, I believe, show two lines one for survival in each of two treatment (Drug) groups, however my plot shows only one line. What am I doing wrong?

My code is reproduced below, my figure is attached to this EMail message.

> #Create simple survival object
> GVHDdata<-list(Time=GVHD$Time,Time30=(GVHD$Time)/30,
+ Age=GVHD$Age,Drug=GVHD$Drug,Died=GVHD$Died,
+ AgeGrp=cut(GVHD$Age,breaks=c(0,15,25,45)))
> summary(GVHD$Drug)
     32      32 
> fit0<-coxph(Surv(Time30,Died)~Drug,data=GVHDdata)
> summary(fit0)
coxph(formula = Surv(Time30, Died) ~ Drug, data = GVHDdata)

  n= 64 
                 coef exp(coef) se(coef)     z     p
Drug[T.MXT+CSP] -1.15     0.316    0.518 -2.23 0.026

                exp(coef) exp(-coef) lower .95 upper .95
Drug[T.MXT+CSP]     0.316       3.16     0.115     0.871

Rsquare= 0.086   (max possible= 0.915 )
Likelihood ratio test= 5.75  on 1 df,   p=0.0165
Wald test            = 4.96  on 1 df,   p=0.026
Score (logrank) test = 5.52  on 1 df,   p=0.0188

> plot(survfit(fit0))

John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information.  Any unauthorized use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. 

More information about the R-help mailing list