PiecewiseExponentialFitter¶
- class lifelines.fitters.piecewise_exponential_fitter.PiecewiseExponentialFitter(breakpoints, *args, **kwargs)¶
This class implements an Piecewise Exponential model for univariate data. The model has parameterized hazard rate:
\[\begin{split}h(t) = \begin{cases} 1/\lambda_0 & \text{if $t \le \tau_0$} \\ 1/\lambda_1 & \text{if $\tau_0 < t \le \tau_1$} \\ 1/\lambda_2 & \text{if $\tau_1 < t \le \tau_2$} \\ ... \end{cases}\end{split}\]You specify the breakpoints, \(\tau_i\), and lifelines will find the optional values for the parameters.
After calling the
.fit
method, you have access to properties like:survival_function_
,plot
,cumulative_hazard_
A summary of the fit is available with the methodprint_summary()
- Parameters:
breakpoints (list) – a list of times when a new exponential model is constructed.
alpha (float, optional (default=0.05)) – the level in the confidence intervals.
- cumulative_hazard_¶
The estimated cumulative hazard (with custom timeline if provided)
- Type:
DataFrame
- hazard_¶
The estimated hazard (with custom timeline if provided)
- Type:
DataFrame
- survival_function_¶
The estimated survival function (with custom timeline if provided)
- Type:
DataFrame
- cumulative_density_¶
The estimated cumulative density function (with custom timeline if provided)
- Type:
DataFrame
- density_¶
The estimated density function (PDF) (with custom timeline if provided)
- Type:
DataFrame
- variance_matrix_¶
The variance matrix of the coefficients
- Type:
DataFrame
- median_survival_time_¶
The median time to event
- Type:
float
- lambda_i_¶
The fitted parameter in the model, for i = 0, 1 … n-1 breakpoints
- Type:
float
- durations¶
The durations provided
- Type:
array
- event_observed¶
The event_observed variable provided
- Type:
array
- timeline¶
The time line to use for plotting and indexing
- Type:
array
- entry¶
The entry array provided, or None
- Type:
array or None
- breakpoints¶
The provided breakpoints
- Type:
array