Solution (source code)

= Solution

The history $\mathcal H_{t-}$ contains the information observed strictly before $t$: baseline characteristics, previous events and <censoring>, and therefore which individuals are currently eligible and under observation. Formally it is the pre-$t$ information in the relevant <filtration>. The <at-risk process> $Y_i(t)$ is 1 if individual $i$ is observed and event-free immediately before $t$, and 0 otherwise. Let $Y_+(t)=\sum_iY_i(t)$ and write $dH(t)=h(t)dt$ for the <cumulative hazard> increment.

The <counting-process intensity in survival analysis> gives
$$
\boxed{\Pr(dN_i(t)=1\mid\mathcal H_{t-})
=Y_i(t)h(t)dt+o(dt).}
$$
The common conditional <hazard function> is assumed to remain applicable after conditioning on the observed history, as under suitable <independent censoring>. Summing gives \b[the conditional mean of the total event increment]:
$$
\boxed{\mathbb E[dN_+(t)\mid\mathcal H_{t-}]
=Y_+(t)dH(t)+o(dt).}
$$
On times with $Y_+(t)>0$, invert this relation to estimate the hazard increment:
$$
\boxed{d\widehat H(t)=\frac{dN_+(t)}{Y_+(t)},\qquad
\widehat H(t)=\int_0^t\frac{\mathbf1_{\{Y_+(u)>0\}}}{Y_+(u)}\,dN_+(u)
=\sum_{a_j\leq t}\frac1{Y_+(a_j)}.}
$$
The last sum is for untied events. This is the <Nelson–Aalen estimator>; for ties replace 1 by the number of events at that time. No increment can be estimated once the <risk set> is empty.