MixtureCureFitter¶
- class lifelines.fitters.mixture_cure_fitter.MixtureCureFitter(base_fitter, *args, **kwargs)¶
This class implements a Mixture Cure Model for univariate data with a configurable distribution for the non-cure portion. The model survival function has parameterized form:
\[S(t) = c + \left(1 - c\right)S_b(t), \;\; 1 > c > 0\]where \(S_b(t)\) is a parametric survival function describing the non-cure portion of the population, and \(c\) is the cured fraction of the population.
After calling the
.fit
method, you have access to properties like:cumulative_hazard_
,survival_function_
,lambda_
andrho_
. A summary of the fit is available with the methodprint_summary()
. The parameters for both the cure portion of the model and from the base_fitter are available. The cure fraction is calledcured_fraction_
, and parameters from the base_fitter will be available with their own appropriate names.- Parameters:
base_fitter (ParametricUnivariateFitter, required) – an instance of a fitter that describes the non-cure portion of the population.
alpha (float, optional (default=0.05)) – the level in the confidence intervals.
Important
The base_fitter instance is used to describe the non-cure portion of the population, but is not actually fit to the data. Some internal properties are modified, and it should not be used for any other purpose after passing it to the constructor of this class.
Examples
from lifelines import MixtureCureFitter, ExponentialFitter fitter = MixtureCureFitter(base_fitter=ExponentialFitter()) fitter.fit(T, event_observed=observed) print(fitter.cured_fraction_) print(fitter.lambda_) # This is available because it is a parameter of the ExponentialFitter
- cumulative_hazard_¶
The estimated cumulative hazard (with custom timeline if provided)
- Type:
DataFrame
- cured_fraction_¶
The fitted parameter \(c\) in the model
- Type:
float
- 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
- variance_matrix_¶
The variance matrix of the coefficients
- Type:
DataFrame
- median_survival_time_¶
The median time to event
- 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
- percentile(p)¶
Return the unique time point, t, such that S(t) = p.
- Parameters:
p (float)