## 16.1 Background

You can specify the survival distribution function either as a survival function of the form

$S(t) = 1 - F(t) = pr(T > t), \hspace{3mm} 0 < t < \infty$

or as a hazard function, the instantaneous failure rate given survival up to time $$t$$

$h(t) = \lim_{\delta \rightarrow 0}{\frac{pr(t < T < t + \delta|T > 1)}{\delta}}.$

The survival function is the compliment of the the cumulative distribution function. The Kaplan-Meier estimator for the survival function is

$\hat{S} = \prod_{i: t_i < t}{\frac{n_i - d_i}{n_i}}$

where $$n_i$$ is the number of persons under observation at time $$i$$ and $$d_i$$ is the number of individuals dying at time $$i$$. Calculate the Kaplan-Meier estimate with the survfit() function.

library(survival)

tm <- c(

0, # birth

1 / 365,  # first day of life

7 / 365,  # seventh day of life

28 / 365, # fourth week of life

1:110     # subsequent years

)

hazMale = survexp.us[, "male", "2004"]

hazFemale = survexp.us[, "female", "2004"]

#plot(tm, hazMale)