[R] Cox model qustion in R

From: Chao Zhu <cznm4_at_mizzou.edu>
Date: Thu 31 Mar 2005 - 09:04:58 EST


Dear all,

I have a beginner's R question for coxph() and survfit(). I have a data set with survival time (no censoring) and treatment indicator(0/1). I did something like

fit<-coxph( Surv(t)~treat, method="breslow",data=data)
> fit

Call:
coxph(formula = Surv(t) ~ treat, data = data, method = "breslow")

       coef exp(coef) se(coef)     z       p
treat -1.96     0.140    0.243 -8.07 6.7e-16

Likelihood ratio test=80.3 on 1 df, p=0 n= 144

> plot(survfit(fit))

But it only gives me the curve with combined treatment. How do I get a plot with two curves for different treatments. I don't want to do
new<-data.frame(treat=c(0,1))
and plot(survfit(fit,newdata=new)) cause it gives you predicted curves for two treatments.

Thanks you so much for your help.

Jimmy Chu

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Mar 31 09:12:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:57 EST