# [R] [newbie] Cox Baseline Hazard

Thomas Lumley tlumley at u.washington.edu
Thu Feb 22 23:46:41 CET 2001

```On Thu, 22 Feb 2001, Meles MELES wrote:

> Hello everybody.
> First of all, I would like to present myself.
> I'm a french student in public health and I like statistics though I'm
> not that good in mathematics (but I try to catch up). I've discovered R
> recently while trying to find a statistical program in order to avoid
> rebooting my computer under windows when I need to do some statistical
> work.
>
> And here is my first question.
> I'm actually trying to model a survival curve using a cox model.
> But I need the baseline cumulative hazard. I've been looking around on
> the web and the archives, and I found that it as to do with the
> nelson-aalen estimation.
> But I must not understand all the doc very well, because I can't get
> the baseline hazard.
> Could you help me, please.

In the survival5 package the function survfit() will extract baseline
survival from a Cox model.

In order to get the baseline hazard you need to transform the baseline
survival.  There are two methods of calculating the baseline survival, the
default one gives the baseline hazard estimator you want. It is attributed
to Aalen, Breslow, or Peto, depending on who one asks.

Using the example from help(survfit)

#fit a cox proportional hazards model and plot the
#predicted survival curve
data(ovarian)
fit <- coxph( Surv(futime,fustat)~resid.ds+rx+ecog.ps,data=ovarian)

Compute the survival function
ss<-survfit(fit)

Now you can graph the baseline cumulative hazard with
plot(ss,fun="cumhaz")

or extract the information into a variable with
cumulative.hazard<- -log(ss\$surv)
observation.times<-ss\$time

The survival object "ss" also contains upper and lower confidence bounds
and other information about the survival curve

-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```