Solution (source code)

= Solution

Take the 2017 calendar window to be $[1,13]$ on the supplied month scale. Intersecting each follow-up interval with this window and translating to time since diagnosis gives:

* patient 1: delayed entry at duration 10 and censoring at 22;
* patient 3: delayed entry at 8 and death at 15;
* patient 4: delayed entry at 4 and censoring at 7;
* patient 5: delayed entry at 2 and censoring at 14;
* patient 6: entry at 0 and censoring at 9;
* patient 7: entry at 0 and death at 6;
* patient 8: entry at 0 and censoring at 6;
* patient 9: entry at 0 and censoring at 4.

Patient 2 died before the period and patient 10 entered after it, so neither contributes. At duration 6, patients 4, 5, 6, 7, and 8 are at risk, giving factor $1-1/5=4/5$. At duration 15, patients 1 and 3 are at risk, giving factor $1-1/2=1/2$. Therefore the period <Kaplan–Meier estimator> is
$$
\boxed{
\widehat S_{\mathrm{2017}}(t)=
\begin{cases}
1,&0\leq t<6,\\
4/5,&6\leq t<15,\\
2/5,&t\geq15.
\end{cases}}
$$
over the range supported by the period data.