[R] Question on survival

Chris Andrews chrisaa at umich.edu
Fri Oct 12 14:15:45 CEST 2012


lau pel wrote
> Hi,
> I'm going crazy trying to plot a quite simple graph.
> i need to plot estimated hazard rate from a cox model.
> supposing the model i like this:
> coxPhMod=coxph(Surv(TIME, EV) ~ AGE+A+B+strata(C) data=data)
> with 4 level for C.
> how can i obtain a graph with 4 estimated (better smoothed) hazard curve
> (base-line hazard + 3 proportional) to highlight the effect of C.
> thanks!!
> laudan
> 
> (1) The curves won't be proportional if you stratify on C.  The curves are
> proportional for AGE, A, and B in your model.
> (2) If you want to deal with an individual stratum, you can extract them
> individually from survfit
> 
> dataset <-
>   data.frame(Time = rexp(100, 1),
>              A = rnorm(100),
>              B = rnorm(100),
>              C = factor(rep(letters[1:4],25)))
> mod <- coxph(Surv(Time) ~ A + B + strata(C), data=dataset)
> 
> # first stratum fit
> survfit(mod, newdata=data.frame(A=rep(0,4), B=rep(0,4),
> C=factor(letters[1:4])))[1]
> 
> 
> 
> ______________________________________________

> R-help@

>  mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.





--
View this message in context: http://r.789695.n4.nabble.com/Question-on-survival-tp4645926p4645986.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list