NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3117 most downloaded on PyPI
Survival analysis in Python, including Kaplan Meier, Nelson Aalen and regression
Last release 7 months ago
05 Mar 2026
Release timing varies
gaps range from 2 weeks to 1.3 years
Nearly every release is documented
notes for 60 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
13 years old
175 releases · first in 2013
Serializing lifelines is better supported. Packages like joblib and pickle are now supported. Thanks @AbdealiJK!
conditional_after now available in CoxPHFitter.predict_medianSerializing lifelines is better supported. Packages like joblib and pickle are now supported. Thanks @AbdealiJK!
conditional_after now available in CoxPHFitter.predict_median
Suppressed some unimportant warnings.
fixed initial_point being ignored in AFT models.
One column per quarter.
new ApproximationWarning to tell you if the package is making an potentially bad approximation.
ApproximationWarning to tell you if the package is making an potentially bad approximation.print_summary.survival_difference_at_fixed_point_in_time_testutils.qth_survival_time no longer takes a cdf argument - users should take the compliment (1-cdf).StatisticalWarnings have been replaced by ApproximationWarningnew ApproximationWarning to tell you if the package is making an potentially mislead approximation.
fixed a bug in parametric prediction for interval censored data.
realigned values in print_summary.
fixed bug in survival_difference_at_fixed_point_in_time_test
utils.qth_survival_time no longer takes a cdf argument - users should take the compliment (1-cdf).
Some previous StatisticalWarnings have been replaced by ApproximationWarning
conditional_after works for CoxPHFitter prediction models 😅
conditional_after works for CoxPHFitter prediction models 😅CoxPHFitter.baseline_cumulative_hazard_'s column is renamed "baseline cumulative hazard" - previously it was "baseline hazard". (Only applies if the model has no strata.)utils.dataframe_interpolate_at_times renamed to utils.interpolate_at_times_and_return_pandas.conditional_after works for CoxPHFitter prediction models 😅
CoxPHFitter.baseline_cumulative_hazard_’s column is renamed "baseline cumulative hazard" - previously it was "baseline hazard". (Only applies if the model has no strata.)
utils.dataframe_interpolate_at_times renamed to utils.interpolate_at_times_and_return_pandas.
Improvements to the __repr__ of models that takes into accounts weights.
fit_interval_censoring wouldn't accept lists.AalenJohansenFitter failing to plot confidence intervals._get_initial_value in parametric univariate models is renamed _create_initial_pointImprovements to the repr of models that takes into accounts weights.
Better support for predicting on Pandas Series
Fixed issue where fit_interval_censoring wouldn’t accept lists.
Fixed an issue with AalenJohansenFitter failing to plot confidence intervals.
_get_initial_value in parametric univariate models is renamed _create_initial_point
Some performance improvements to regression models.
utils.restricted_mean_survival_time that approximates the RMST using numerical integration against survival functions.KaplanMeierFitter.survival_function_'s' index is no longer given the name "timeline".concordance_index would never exit if NaNs in dataset.Some performance improvements to regression models.
lifelines will avoid penalizing the intercept (aka bias) variables in regression models.
new utils.restricted_mean_survival_time that approximates the RMST using numerical integration against survival functions.
KaplanMeierFitter.survival_function_‘s’ index is no longer given the name “timeline”.
Fixed issue where concordance_index would never exit if NaNs in dataset.
model's now expose a log_likelihood_ property.
log_likelihood_ property.conditional_after argument on predict_* methods that make prediction on censored subjects easier.lifelines.utils.safe_exp to make exp overflows easier to handle.GeneralizedGammaRegressionFitterlifelines.utils.gamma - use autograd_gamma library instead.exp overflow warnings have been eliminated.predict_percentile of LogLogisticAFTFitter. New tests have been added around this.lifelines is now compatible with scipy>=1.3.0
GeneralizedGammaFitter is more stable, maybe.lifelines is now compatible with scipy>=1.3.0
fixed printing error when using robust=True in regression models
GeneralizedGammaFitter is more stable, maybe.
lifelines was allowing old version of numpy (1.6), but this caused errors when using the library. The correctly numpy has been pinned (to 1.14.0+)
New univariate model, GeneralizedGammaFitter. This model contains many sub-models, so it is a good model to check fits.
GeneralizedGammaFitter. This model contains many sub-models, so it is a good model to check fits.initial_point option in univariate parametric fitters.initial_point kwarg is present in parametric univariate fitters .fitevent_table is now an attribute on all univariate fitters (if right censoring)lifelines.utils.gammaconfidence_intervals_ has changed to include the alpha value..summary and .print_summary has changed to include the alpha value..summary and .print_summary includes confidence intervals for the exponential of the value.censors_show in plotting functions, the censor ticks are now reactive to the estimate being shown.KaplanMeierFitter confidence intervalsCoxTimeVaryingFitterAbility to create custom parametric regression models by specifying the cumulative hazard. This enables new and extensions of AFT models.
percentile(p) method added to univariate models that solves the equation p = S(t) for tconditional_time_to_event_ is now exact instead of an approximation.hazards_ has been renamed to params_. This aligns better with the other regression models, and is more clear (what is a hazard anyways?)hazard_ratios_ attribute is available which is the exponentiation of params_.confidence_intervals_ has changed to include the alpha value..summary and .print_summary has changed to include the alpha value..summary and .print_summary includes confidence intervals for the exponential of the value.fit_intercept works in AFT models. Previously one could set fit_intercept to False and not have to set ancillary_df - now one must specify a DataFrame.conditional_time_to_event_ is now exact instead of an approximation.Ability to create custom parametric regression models by specifying the cumulative hazard. This enables new and extensions of AFT models.
percentile(p) method added to univariate models that solves the equation p = S(t) for t
for parametric univariate models, the conditional_time_to_event_ is now exact instead of an approximation.
In Cox models, the attribute hazards_ has been renamed to params_. This aligns better with the other regression models, and is more clear (what is a hazard anyways?)
In Cox models, a new hazard_ratios_ attribute is available which is the exponentiation of params_.
In Cox models, the column names in confidence_intervals_ has changed to include the alpha value.
In Cox models, some column names in .summary and .print_summary has changed to include the alpha value.
In Cox models, some column names in .summary and .print_summary includes confidence intervals for the exponential of the value.
Significant changes to internal AFT code.
A change to how fit_intercept works in AFT models. Previously one could set fit_intercept to False and not have to set ancillary_df - now one must specify a DataFrame.
for parametric univariate models, the conditional_time_to_event_ is now exact instead of an approximation.
fixed a name error bug in CoxTimeVaryingFitter.plot
I'm skipping 0.21.4 version because of deployment issues.
I'm skipping 0.21.4 version because of deployment issues.
scoring_method now a kwarg on sklearn_adapterI’m skipping 0.21.4 version because of deployment issues.
scoring_method now a kwarg on sklearn_adapter
fixed an implicit import of scikit-learn. scikit-learn is an optional package.
fixed visual bug that misaligned x-axis ticks and at-risk counts. Thanks @christopherahern!
include in lifelines is a scikit-learn adapter so lifeline's models can be used with scikit-learn's API. See documentation here.
CoxPHFitter.plot now accepts a hazard_ratios (boolean) parameter that will plot the hazard ratios (and CIs) instead of the log-hazard ratios.CoxPHFitter.check_assumptions now accepts a columns parameter to specify only checking a subset of columns.covariates_from_event_matrix handle nulls betterinclude in lifelines is a scikit-learn adapter so lifeline’s models can be used with scikit-learn’s API. See documentation here.
CoxPHFitter.plot now accepts a hazard_ratios (boolean) parameter that will plot the hazard ratios (and CIs) instead of the log-hazard ratios.
CoxPHFitter.check_assumptions now accepts a columns parameter to specify only checking a subset of columns.
covariates_from_event_matrix handle nulls better
New regression model: PiecewiseExponentialRegressionFitter is available. See blog post here: https://dataorigami.net/blogs/napkin-folding/churn
PiecewiseExponentialRegressionFitter is available. See blog post here: https://dataorigami.net/blogs/napkin-folding/churnlog_likelihood_ratio_test that computes, you guessed it, the log-likelihood ratio test. Previously this was an internal API that is being exposed.predict method on non-parametric estimators (KaplanMeierFitter, etc.) has changed from (previous) linear interpolation to (new) return last value. Linear interpolation is still possible with the interpolate flag._compute_likelihood_ratio_test on regression models. Use log_likelihood_ratio_test now.New regression model: PiecewiseExponentialRegressionFitter is available. See blog post here: https://dataorigami.net/blogs/napkin-folding/churn
Regression models have a new method log_likelihood_ratio_test that computes, you guessed it, the log-likelihood ratio test. Previously this was an internal API that is being exposed.
The default behavior of the predict method on non-parametric estimators (KaplanMeierFitter, etc.) has changed from (previous) linear interpolation to (new) return last value. Linear interpolation is still possible with the interpolate flag.
removing _compute_likelihood_ratio_test on regression models. Use log_likelihood_ratio_test now.
users can provided their own start and stop column names in add_covariate_to_timeline
add_covariate_to_timelinesurvival_table_from_events when collapsing rows to intervals now removes the "aggregate" column multi-index.users can provided their own start and stop column names in add_covariate_to_timeline
PiecewiseExponentialFitter now allows numpy arrays as breakpoints
output of survival_table_from_events when collapsing rows to intervals now removes the “aggregate” column multi-index.
fixed bug in CoxTimeVaryingFitter when ax is provided, thanks @j-i-l!
left_censorship on all univariate fitters has been deprecated. Please use the new api model.fit_left_censoring(...).
weights is now a optional kwarg for parametric univariate models.fit_right_censoring (which is an alias for fit), fit_left_censoring and fit_interval_censoring.lifelines.datasets.load_diabetesleft_censorship on all univariate fitters has been deprecated. Please use the new
api model.fit_left_censoring(...).invert_y_axis in model.plot(... has been removed.entries property in multivariate parametric models has a new Series name: entryperformance improvements for print_summary.
print_summary.utils.survival_events_from_table returns an integer weight vector as well as durations and censoring vector.AalenJohansenFitter, the variance parameter is renamed to variance_ to align with the usual lifelines convention.CoxTimeVaryingFitter's likelihood ratio test when using strata.AalenJohansenFitterperformance improvements for print_summary.
utils.survival_events_from_table returns an integer weight vector as well as durations and censoring vector.
in AalenJohansenFitter, the variance parameter is renamed to variance_ to align with the usual lifelines convention.
Fixed an error in the CoxTimeVaryingFitter’s likelihood ratio test when using strata.
Fixed some plotting bugs with AalenJohansenFitter
left-truncation support in AFT models, using the entry_col kwarg in fit()
entry_col kwarg in fit()generate_datasets.piecewise_exponential_survival_data for generating piecewise exp. dataprint_summary for AFT models.print_summaryPiecewiseExponentialFitter is available with from lifelines import *.left-truncation support in AFT models, using the entry_col kwarg in fit()
generate_datasets.piecewise_exponential_survival_data for generating piecewise exp. data
Faster print_summary for AFT models.
Pandas is now correctly pinned to >= 0.23.0. This was always the case, but not specified in setup.py correctly.
Better handling for extremely large numbers in print_summary
PiecewiseExponentialFitter is available with from lifelines import *.
Now cumulative_density_ & survival_function_ are _always_ present on a fitted KaplanMeierFitter.
cumulative_density_ & survival_function_ are always present on a fitted KaplanMeierFitter.KaplanMeierFitter: plot_cumulative_density(), confidence_interval_cumulative_density_, plot_survival_function and confidence_interval_survival_function_.Now cumulative_density_ & survival_function_ are always present on a fitted KaplanMeierFitter.
New attributes/methods on KaplanMeierFitter: plot_cumulative_density(), confidence_interval_cumulative_density_, plot_survival_function and confidence_interval_survival_function_.
Left censoring is now supported in univariate parametric models: .fit(..., left_censorship=True). Examples are in the docs.
.fit(..., left_censorship=True). Examples are in the docs.lifelines.datasets.load_nh4().cumulative_density_, .confidence_interval_cumulative_density_, plot_cumulative_density(), cumulative_density_at_times(t).lifelines.plotting.qq_plot for univariate parametric models that handles censored data.plot_lifetimes no longer reverses the order when plotting. Thanks @vpolimenov!C column in load_lcd dataset is renamed to E.KaplanMeierFitter when left_censorship was set to True, plot_cumulative_density_() is now plot_cumulative_density().qth_survival_times for a truncated CDF would return np.inf if the q parameter was below the truncation limit. This should have been -np.infSome performance improvements to CoxPHFitter (about 30%). I know it may seem silly, but we are now about the same or slighty faster than the Cox model
CoxPHFitter (about 30%). I know it may seem silly, but we are now about the same or slighty faster than the Cox model in R's survival package (for some testing datasets and some configurations). This is a big deal, because 1) lifelines does more error checking prior, 2) R's cox model is written in C, and we are still pure Python/NumPy, 3) R's cox model has decades of development.cph.baseline_hazard_, even if there were no event at this time. This is no longer the case. A 0 will still be added if there is a duration (observed or not) at 0 occurs however.Starting with 0.20.0, only Python3 will be supported. Over 75% of recent installs where Py3.
inital_beta in Cox model's .fit is now initial_point.initial_point is now available in AFT models and CoxTimeVaryingFitterconfidence_intervals_ for univariate models is transposed now (previous parameters where columns, now parameters are rows).check_assumptions.Starting with 0.20.0, only Python3 will be supported. Over 75% of recent installs where Py3.
Updated minimum dependencies, specifically Matplotlib and Pandas.
smarter initialization for AFT models which should improve convergence.
initial_beta in Cox model’s .fit is now initial_point.
initial_point is now available in AFT models and CoxTimeVaryingFitter
the DataFrame confidence_intervals_ for univariate models is transposed now (previous parameters where columns, now parameters are rows).
Fixed a bug with plotting and check_assumptions.
plot_covariate_group can accept multiple covariates to plot. This is useful for columns that have implicit correlation like polynomial features or cat
plot_covariate_group can accept multiple covariates to plot. This is useful for columns that have implicit correlation like polynomial features or categorical variables.plot_covariate_group can accept multiple covariates to plot. This is useful for columns that have implicit correlation like polynomial features or categorical variables.
Convergence improvements for AFT models.
remove some bad print statements in CoxPHFitter.
CoxPHFitter.new AFT models: LogNormalAFTFitter and LogLogisticAFTFitter.
LogNormalAFTFitter and LogLogisticAFTFitter.weights_col argument to fit.robust=True kwarg in fit.print_summary in the CoxPHFitter and CoxTimeVaryingFitter model.new AFT models: LogNormalAFTFitter and LogLogisticAFTFitter.
AFT models now accept a weights_col argument to fit.
Robust errors (sandwich errors) are now available in AFT models using the robust=True kwarg in fit.
Performance increase to print_summary in the CoxPHFitter and CoxTimeVaryingFitter model.
ParametricUnivariateFitters, like WeibullFitter, have smoothed plots when plotting (vs stepped plots)
ParametricUnivariateFitters, like WeibullFitter, have smoothed plots when plotting (vs stepped plots)ExponentialFitter log likelihood value was incorrect - inference was correct however.ParametricUnivariateFitters, like WeibullFitter, have smoothed plots when plotting (vs stepped plots)
The ExponentialFitter log likelihood value was incorrect - inference was correct however.
Univariate fitters are more flexiable and can allow 2-d and DataFrames as inputs.
improved stability of LogNormalFitter
LogNormalFitterPiecewiseExponential to the same as ExponentialFitter (from \lambda * t to t / \lambda).improved stability of LogNormalFitter
Matplotlib for Python3 users are not longer forced to use 2.x.
Important: we changed the parameterization of the PiecewiseExponential to the same as ExponentialFitter (from \lambda * t to t / \lambda).
New regression model WeibullAFTFitter for fitting accelerated failure time models. Docs have been added to our documentation about how to use WeibullA
WeibullAFTFitter for fitting accelerated failure time models. Docs have been added to our documentation about how to use WeibullAFTFitter (spoiler: it's API is similar to the other regression models) and how to interpret the output.CoxPHFitter performance improvements (about 10%)CoxTimeVaryingFitter performance improvements (about 10%).hazards_ and .standard_errors_ on Cox models to be pandas Series (instead of Dataframes). This felt like a more natural representation of them. You may need to update your code to reflect this. See notes here: https://github.com/CamDavidsonPilon/lifelines/issues/636.confidence_intervals_ on Cox models to be transposed. This felt like a more natural representation of them. You may need to update your code to reflect this. See notes here: https://github.com/CamDavidsonPilon/lifelines/issues/636WeibullFitter and ExponentialFitter from \lambda * t to t / \lambda. This was for a few reasons: 1) it is a more common parameterization in literature, 2) it helps in convergence.AalenAdditiveModel), the name of the added column has been changed from baseline to _interceptalpha in all fitters has changed to be the standard interpretation of alpha in confidence intervals. That means that the default for alpha is set to 0.05 in the latest lifelines, instead of 0.95 in previous versions._log_likelihood_ property of ParametericUnivariateFitter models. It was showing the "average" log-likelihood (i.e. scaled by 1/n) instead of the total. It now displays the total.print_summarys, correct a label erroring. Instead of "Likelihood test", it should have read "Log-likelihood test".event columns.some improvements to the output of check_assumptions. show_plots is turned to False by default now. It only shows rank and km p-values now.
check_assumptions. show_plots is turned to False by default now. It only shows rank and km p-values now.qth_survival_time.added new plotting methods to parametric univariate models: plot_survival_function, plot_hazard and plot_cumulative_hazard. The last one is an alias f
plot_survival_function, plot_hazard and plot_cumulative_hazard. The last one is an alias for plot.confidence_interval_survival_function_, confidence_interval_hazard_, confidence_interval_cumulative_hazard_. The last one is an alias for confidence_interval_.AalenJohansenFitter's variance calculations when using large datasets.AalenJohansenFitter that causing some datasets with to be jittered too often.AalenJohansenFitter, calculate_variance that can be used to turn off variance calculations since this can take a long time for large datasets. Thanks @pzivich!fixed confidence intervals in cumulative hazards for parametric univarite models. They were previously serverly depressed.
entry kwarg in .fitSome performance improvements to parametric univariate models.
New univariate fitter PiecewiseExponentialFitter for creating a stepwise hazard model. See docs online.
PiecewiseExponentialFitter for creating a stepwise hazard model. See docs online.ParametericUnivariateFitter super class. See docs online for how to do this.pickle. The library dill is still useable.autograd.LogNormalFitter no longer models log_sigma.bug fixes in LogNormalFitter variance estimates
LogNormalFitter variance estimatesLogNormalFitter. We now model the log of sigma internally, but still expose sigma externally.autograd lib to help with gradients.LogLogisticFitter univariate fitter available.LogNormalFitter is a new univariate fitter you can use.
LogNormalFitter is a new univariate fitter you can use.WeibullFitter now correctly returns the confidence intervals (previously returned only NaNs)WeibullFitter.print_summary() displays p-values associated with its parameters not equal to 1.0 - previously this was (implicitly) comparing against 0, which is trivially always true (the parameters must be greater than 0)ExponentialFitter.print_summary() displays p-values associated with its parameters not equal to 1.0 - previously this was (implicitly) comparing against 0, which is trivially always true (the parameters must be greater than 0)ExponentialFitter.plot now displays the cumulative hazard, instead of the survival function. This is to make it easier to compare to WeibullFitter and LogNormalFittercumulative_hazard_at_times, hazard_at_times, survival_function_at_times return pandas Series now (use to be numpy arrays)alpha keyword from all statistical functions. This was never being used.print_summary functions that represent signficance thresholds.summary (including print_summary), the log(p) term has changed to -log2(p). This is known as the s-value. See https://lesslikely.com/statistics/s-values/survival_difference_at_fixed_point_in_time_test,...LinAlgError: Matrix is singular. and report back to the user advice.more bugs in plot_covariate_groups fixed when using non-numeric strata.
plot_covariate_groups fixed when using non-numeric strata.more bugs in plot_covariate_groups fixed when using non-numeric strata.
Fix bug in plot_covariate_groups that wasn't allowing for strata to be used.
plot_covariate_groups that wasn't allowing for strata to be used.multicenter_aids_cohort_study to load_multicenter_aids_cohort_studyplot_covariate_groups that wasn't allowing for strata to be used.multicenter_aids_cohort_study to load_multicenter_aids_cohort_studygroups is now called values in CoxPHFitter.plot_covariate_groupsFix in compute_residuals when using schoenfeld and the minumum duration has only censored subjects.
compute_residuals when using schoenfeld and the minumum duration has only censored subjects.Fix in compute_residuals when using schoenfeld and the minimum duration has only censored subjects.
Another round of serious performance improvements for the Cox models. Up to 2x faster for CoxPHFitter and CoxTimeVaryingFitter. This was mostly the re
einsum to simplify a previous for loop. The downside is the code is more esoteric now.einsum to simplify a previous for loop. The downside is the code is more esoteric now. I've added comments as necessary though 🤞adding bottleneck as a dependency. This library is highly-recommended by Pandas, and in lifelines we see some nice performance improvements with it to
CoxPHFitter)CoxPHFitter when using batch_mode that was causing coefficients to deviate from their MLE value. This bug eluded tests, which means that it's discrepancy was less than 0.0001 difference. It's fixed now, and even more accurate tests are added.CoxPHFitter._compute_likelihood_ratio_test()CoxTimeVaryingFitter.CoxTimeVaryingFitter.corrected behaviour in CoxPHFitter where score_ was not being refreshed on every new fit.
CoxPHFitter where score_ was not being refreshed on every new fit.AalenAdditiveFitter. There were significant changes to it:
AalenAdditiveFitter. This will return in a future release.print_summaryweights_col is addednn_cumulative_hazard is removed (may add back)multicenter_aids_cohort_study from Cole SR, Hudgens MG. Survival analysis in infectious disease research: describing events in time. AIDS. 2010;24(16):2423-31.corrected behaviour in CoxPHFitter where score_ was not being refreshed on every new fit.
Reimplentation of AalenAdditiveFitter. There were significant changes to it:
implementation is at least 10x faster, and possibly up to 100x faster for some datasets.
memory consumption is way down
removed the time-varying component from AalenAdditiveFitter. This will return in a future release.
new print_summary
weights_col is added
nn_cumulative_hazard is removed (may add back)
some plotting improvements to plotting.plot_lifetimes
More CoxPHFitter performance improvements. Up to a 40% reduction vs 0.16.2 for some datasets.
CoxPHFitter performance improvements. Up to a 40% reduction vs 0.16.2 for some datasets.More CoxPHFitter performance improvements. Up to a 40% reduction vs 0.16.2 for some datasets.
Fixed CoxTimeVaryingFitter to allow more than one variable to be stratafied
CoxTimeVaryingFitter to allow more than one variable to be stratafiedCoxPHFitter with dataset has lots of duplicate times. See https://github.com/CamDavidsonPilon/lifelines/issues/591Fixed py2 division error in concordance method.
concordance method.introduction of residual calculations in CoxPHFitter.compute_residuals. Residuals include "schoenfeld", "score", "delta_beta", "deviance", "martingale
CoxPHFitter.compute_residuals. Residuals include "schoenfeld", "score", "delta_beta", "deviance", "martingale", and "scaled_schoenfeld".estimation namespace for fitters. Should be using from lifelines import xFitter now. Thanks @usmanatronpredict_log_hazard_relative_to_mean from Cox model. Thanks @usmanatronStatisticalResult has be generalized to allow for multiple results (ex: from pairwise comparisons). This means a slightly changed API that is mostly backwards compatible. See doc string for how to use it.statistics.pairwise_logrank_test now returns a StatisticalResult object instead of a nasty NxN DataFrame 💗print_summary. Also, p-values below thesholds will be truncated. The orignal p-values are still recoverable using .summary.print_summary is now displayed to 2 decimal points. This can be changed using the decimal kwarg.standardized from Cox model plotting. It was confusing..plotprint_summary methods accepts kwargs to also be displayed.CoxPHFitter has a new human-readable method, check_assumptions, to check the assumptions of your Cox proportional hazard model.lifelines.utils.to_episodic_format.CoxTimeVaryingFitter now accepts strata.bug fix for the Cox model likelihood ratio test when using non-trivial weights.
bug fix for the Cox model likelihood ratio test when using non-trivial weights.
Only allow matplotlib less than 3.0.
plotting.plot_lifetimescluster_col and strata can be used together in CoxPHFitterentry from ExponentialFitter and WeibullFitter as it was doing nothing.API changes to plotting.plot_lifetimes
plotting.plot_lifetimescluster_col and strata can be used together in CoxPHFitterentry from ExponentialFitter and WeibullFitter as it was doing nothing.Raise NotImplementedError if the robust flag is used in CoxTimeVaryingFitter - that's not ready yet.
robust flag is used in CoxTimeVaryingFitter - that's not ready yet.adding robust params to CoxPHFitter's fit. This enables atleast i) using non-integer weights in the model (these could be sampling weights like IPTW),
robust params to CoxPHFitter's fit. This enables atleast i) using non-integer weights in the model (these could be sampling weights like IPTW), and ii) mis-specified models (ex: non-proportional hazards). Under the hood it's a sandwich estimator. This does not handle ties, so if there are high number of ties, results may significantly differ from other software.standard_errors_ is now a property on fitted CoxPHFitter which describes the standard errors of the coefficients.variance_matrix_ is now a property on fitted CoxPHFitter which describes the variance matrix of the coefficients.CoxPHFitter and CoxTimeVaryingFitter called the Newton-decrement. Tests show it is as accurate (w.r.t to previous coefficients) and typically shaves off a single step, resulting in generally faster convergence. See https://www.cs.cmu.edu/~pradeepr/convexopt/Lecture_Slides/Newton_methods.pdf. Details about the Newton-decrement are added to the show_progress statements.ConvergenceError, instead of a ValueError (the former is a subclass of the latter, however).AalenAdditiveModel raises ConvergenceWarning instead of printing a warning.KaplanMeierFitter now has a cumulative plot option. Example kmf.plot(invert_y_axis=True)weights_col option has been added to CoxTimeVaryingFitter that allows for time-varying weights.WeibullFitter has a new show_progress param and additional information if the convergence fails.CoxPHFitter, ExponentialFitter, WeibullFitter and CoxTimeVaryFitter method print_summary is updated with new fields.WeibullFitter has renamed the incorrect _jacobian to _hessian_.variance_matrix_ is now a property on fitted WeibullFitter which describes the variance matrix of the parameters.WeibullFitter().timeline has changed from integers between the min and max duration to n floats between the max and min durations, where n is the number of observations.CoxPHFitter (~20% faster)CoxTimeVaryingFitter (~100% faster)pickle. Thanks @dwilson1988 for the contribution. For Python2, dill is still the preferred method.baseline_cumulative_hazard_ (and derivatives of that) on CoxPHFitter now correctly incorporate the weights_col.KaplanMeierFitter when late entry times lined up with death events. Thanks @pzivichcluster_col argument to CoxPHFitter so users can specify groups of subjects/rows that may be correlated.., etc.). This deviates with how they are presented in other software. There is an argument to be made to remove p-values from lifelines altogether (become the changes you want to see in the world lol), but I worry that people could compute the p-values by hand incorrectly, a worse outcome I think. So, this is my stance. P-values between 0.1 and 0.05 offer very little information, so they are removed. There is a growing movement in statistics to shift "signficant" findings to p-values less than 0.01 anyways.AalenJohansenFitter. Thanks @pzivich! See "Methodologic Issues When Estimating Risks in Pharmacoepidemiology" for a nice overview of the model.fix for n > 2 groups in multivariate_logrank_test (again).
multivariate_logrank_test (again).event_observed column was not boolean.fix for n > 2 groups in multivariate_logrank_test
multivariate_logrank_testfix for n > 2 groups in multivariate_logrank_test
fix weights in KaplanMeierFitter when using a pandas Series.
Adds baseline_cumulative_hazard_ and baseline_survival_ to CoxTimeVaryingFitter. Because of this, new prediction methods are available.
baseline_cumulative_hazard_ and baseline_survival_ to CoxTimeVaryingFitter. Because of this, new prediction methods are available.add_covariate_to_timeline when using cumulative_sum with multiple columns.Likelihood ratio test to CoxPHFitter.print_summary and CoxTimeVaryingFitter.print_summaryCoxTimeVaryingFitter that check for immediate deaths and redundant rows.delay parameter in add_covariate_to_timelinetwo_sided_z_test from statisticsfixes a bug when subtracting or dividing two UnivariateFitters with labels.
UnivariateFitters with labels.CoxTimeVaryingFitter predict methods.column argument to CoxTimeVaryingFitter and CoxPHFitter plot method to plot only a subset of columns.Some quality of life improvements
Some quality of life improvements
CoxTimeVaryingFitter including new predict_ methods.some quality of life improvements for working with CoxTimeVaryingFitter including new predict_ methods.
fixed bug with using weights and strata in CoxPHFitter
CoxPHFitterKaplanMeierFitterCoxPHFitter for up to 40% faster completion of fit.
step_size calculations for iterative optimizations.AalenAdditiveFitter for up to 50% faster completion of fit for large dataframes, and up to 10% faster for small dataframes.adding plot_covariate_groups to CoxPHFitter to visualize what happens to survival as we vary a covariate, all else being equal.
plot_covariate_groups to CoxPHFitter to visualize what happens to survival as we vary a covariate, all else being equal.utils functions like qth_survival_times and median_survival_times now return the transpose of the DataFrame compared to previous version of lifelines. The reason for this is that we often treat survival curves as columns in DataFrames, and functions of the survival curve as index (ex: KaplanMeierFitter.survival_function_ returns a survival curve at time t).KaplanMeierFitter.fit and NelsonAalenFitter.fit accept a weights vector that can be used for pre-aggregated datasets. See this issue.ConvergenceWarning instead of a RuntimeWarningImplements a new fitter CoxTimeVaryingFitter available under the lifelines namespace. This model implements the Cox model for time-varying covariates.
CoxTimeVaryingFitter available under the lifelines namespace. This model implements the Cox model for time-varying covariates.utils.CoxPHFitter.fit now has accepts a weight_col kwarg so one can pass in weights per observation. This is very useful if you have many subjects, and the space of covariates is not large. Thus you can group the same subjects together and give that observation a weight equal to the count. Altogether, this means a much faster regression.is_significant and test_result from StatisticalResult. Users can instead choose their significance level by comparing to p_value. The string representation of this class has changed aswell.CoxPHFitter and AalenAdditiveFitter now have a score_ property that is the concordance-index of the dataset to the fitted model.CoxPHFitter has a slightly more intelligent (barely...) way to pick a step size, so convergence should generally be faster.CoxPHFitter and AalenAdditiveFitter no longer have the data property. It was an almost duplicate of the training data, but was causing the model to be very large when serialized.datasets namespace from the main lifelines namespaceremoves include_likelihood from CoxPHFitter.fit - it was not slowing things down much (empirically), and often I wanted it for debugging (I suppose ot
include_likelihood from CoxPHFitter.fit - it was not slowing things down much (empirically), and often I wanted it for debugging (I suppose others do too). It's also another exit condition, so we many exit from the NR iterations faster.step_size param to CoxPHFitter.fit - the default is good, but for extremely large or small datasets this may want to be set manually.CoxPHFitter to check for complete seperation: https://stats.idre.ucla.edu/other/mult-pkg/faq/general/faqwhat-is-complete-or-quasi-complete-separation-in-logisticprobit-regression-and-how-do-we-deal-with-them/utils.survival_table_from_events to bin the index to make the resulting table more readable.Changing liscense to valilla MIT.
NelsonAalenFitter.fit considerably.Changing license to valilla MIT.
Speed up NelsonAalenFitter.fit considerably.
Python3 fix for CoxPHFitter.plot.
CoxPHFitter.plot.in all plot methods, the ix kwarg has been deprecated in favour of a new loc kwarg. This is to align with Pandas deprecating ix
KaplanMeierFitter.plot when using Seaborn and lifelines..plot function to a fitted CoxPHFitter instance. This plots the hazard coefficients and their confidence intervals.ix kwarg has been deprecated in favour of a new loc kwarg. This is to align with Pandas deprecating ixYour coding agent can read these notes before it upgrades. Set up the MCP server →