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

Finak Greg Greg.Finak at ircm.qc.ca
Mon May 11 01:09:22 CEST 2009


   I did not see an attached figure to compare against, perhaps it was removed by the server.  I suspect that:
plot(survfit(fit0,newdata=GVHDdata)
will produce the plot you're looking for. It will generate survival curves for the data in GVHDdata using the estimates from the fit0 coxph model. At least, that's what I gather from the documentation..

Cheers,
On 10/05/09 5:43 PM, "John Sorkin" <jsorkin at grecc.umaryland.edu> wrote:

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


> #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)
    MTX MXT+CSP
     32      32
>
>
>
> fit0<-coxph(Surv(Time30,Died)~Drug,data=GVHDdata)
> summary(fit0)
Call:
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
GRECC (BT/18/GR)
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 th...{{dropped:6}}




More information about the R-help mailing list