relife.nonparametric.NelsonAalen
relife.nonparametric.NelsonAalen¶
- class relife.nonparametric.NelsonAalen[source]¶
Bases:
object
Nelson-Aalen Estimator.
Compute the non-parametric Nelson-Aalen estimator of the cumulative hazard function from lifetime data.
Notes
For a given time instant \(t\) and \(n\) total observations, this estimator is defined as:
\[\hat{H}(t) = \sum_{i: t_i \leq t} \frac{d_i}{n_i}\]where \(d_i\) is the number of failures until \(t_i\) and \(n_i\) is the number of assets at risk just prior to \(t_i\).
The variance estimation is obtained by:
\[\widehat{Var}[\hat{H}(t)] = \sum_{i: t_i \leq t} \frac{d_i}{n_i^2}\]Note that the alternative survivor function estimate:
\[\tilde{S}(t) = \exp{(-\hat{H}(t))}\]is sometimes suggested for the continuous-time case.
References
- 1
Lawless, J. F. (2011). Statistical models and methods for lifetime data. John Wiley & Sons.
Methods
Fit the Nelson-Aalen estimator to lifetime data.
Plot the Nelson-Aalen estimator of the cumulative hazard function.
- fit(time: numpy.ndarray, event: Optional[numpy.ndarray] = None, entry: Optional[numpy.ndarray] = None) relife.nonparametric.NelsonAalen [source]¶
Fit the Nelson-Aalen estimator to lifetime data.
- Parameters
time (1D array) – Array of time-to-event or durations.
event (1D array, optional) –
Array of event types coded as follows:
0 if observation ends before the event has occurred (right censoring)
1 if the event has occured
2 if observation starts after the event has occurred (left censoring)
by default the event has occured for each asset.
entry (1D array, optional) – Array of delayed entry times (left truncation), by default None.
- Returns
The fitted Nelson-Aalen estimator as the current object.
- Return type
- plot(alpha_ci: float = 0.05, **kwargs: numpy.ndarray) None [source]¶
Plot the Nelson-Aalen estimator of the cumulative hazard function.
- Parameters
alpha_ci (float, optional) – \(\alpha\)-value to define the \(100(1-\alpha)\%\) confidence interval, by default 0.05 corresponding to the 95% confidence interval. If set to None or if the model has not been fitted, no confidence interval is plotted.
**kwargs – Extra arguments to specify the plot properties (see matplotlib.pyplot.plot documentation).