= Solution
Let $f_j=\mathbb P(T=t_j)$ and $h_j=\mathbb P(T=t_j\mid T>t_{j-1})$. Since $S(t_{j-1})=\mathbb P(T>t_{j-1})$, the <discrete hazard> satisfies $h_j=f_j/S(t_{j-1})$. Hence
$$
S(t_j)=S(t_{j-1})-f_j=S(t_{j-1})(1-h_j).
$$
Starting from $S(0)=1$ and iterating, the <survival function> is
$$
\boxed{S(t)=\prod_{j:t_j\le t}(1-h_j).}
$$
Under <independent censoring>, the <risk set> just before $t_j$ gives the binomial conditional failure likelihood $h_j^{d_j}(1-h_j)^{n_j-d_j}$, whose maximizer is $\widehat h_j=d_j/n_j$. This gives the Kaplan–Meier estimator
$$
\boxed{\widehat S(t)=\prod_{j:t_j\le t}\left(1-\frac{d_j}{n_j}\right).}
$$
Failures at exactly $t$ are included because the target is $\mathbb P(T>t)$. Censored subjects contribute to earlier <risk sets> and leave before later ones; they do not create a failure factor. The usual convention includes a subject censored at a tied failure time in the <risk set> for that failure. Estimation beyond the last observed failure is limited by the available follow-up.
Back to article page