We have seen the Cox proportional hazard estimator in the previous recipe The Nelson-Aalen estimator is a non-parametric estimator that estimates the cumulative number of expected events. It gives an idea about the hazard rate shape.
Perform the following steps in R:
> sfitall = survfit(Surv(time, status)~1, data =cancer) > c = coxph(formula=Surv(time, status)~1, data=cancer) > n=basehaz(c)
Printing n
will display all the hazard values with time. Plotting the same will be easy to understand:
> plot(n)
Plot of hazard and time
Using the basehaz
function will compute the hazard estimator for the Cox model using the Breslow estimator, which will be the same as the Nelson-Aalen estimator. It can also be computed using the cumsum
function, which returns cumulative sums. The hazard function is simply an event divided by risk...