Offset-adjusted cumulative hazard estimator (source code)

= Offset-adjusted cumulative hazard estimator
{title2=$\widehat H_1=\int\frac{dN-\sum_iY_i h_{0i}\,dt}{Y}$}

Suppose individual event hazards have the additive form $h_i=h_{0i}+h_1$, where $h_{0i}$ is known and $h_1$ is common. The aggregate <counting-process intensity in survival analysis> is $\lambda=\sum_iY_ih_{0i}+Yh_1$, with $Y=\sum_iY_i$ the current <risk set> size. Writing $dN=\lambda\,dt+dM$ and dividing by $Y$ gives
$$
\widehat H_1(t)=\int_0^t\frac{\mathbf1_{\{Y>0\}}}{Y}\,dN-\int_0^t\mathbf1_{\{Y>0\}}\frac{\sum_iY_ih_{0i}}{Y}\,du
=\int_0^t\mathbf1_{\{Y>0\}}h_1\,du+\int_0^t\frac{\mathbf1_{\{Y>0\}}}{Y}\,dM.
$$
The last term is a <counting-process martingale> integral. This establishes the cumulative common-hazard target on the observed at-risk time range. The known offset must be averaged over the current <risk set>, not the initial sample. Between event jumps, its subtraction can make the unconstrained estimate decrease. If all known hazards equal $h_0$ and $Y>0$ up to $t$, the estimate reduces to the <Nelson–Aalen estimator> minus $H_0(t)$.