ehrapy.tools.log_logistic_aft¶
- ehrapy.tools.log_logistic_aft(adata, duration_col, event_col, entry_col=None)[source]¶
Fit the log logistic accelerated failure time regression for the survival function. The Log-Logistic Accelerated Failure Time (AFT) survival regression model is a powerful statistical tool employed in the analysis of time-to-event data. This model operates under the assumption that the logarithm of survival time adheres to a log-logistic distribution, offering a flexible framework for understanding the impact of covariates on survival times. By modeling survival time as a function of predictors, the Log-Logistic AFT model enables researchers to explore how specific factors influence the acceleration or deceleration of failure times, providing valuable insights into the underlying mechanisms driving event occurrence. See https://lifelines.readthedocs.io/en/latest/fitters/regression/LogLogisticAFTFitter.html
- Parameters:
adata (
AnnData
) – AnnData object with necessary columns duration_col and event_col.duration_col (
str
) – Name of the column in the AnnData objects that contains the subjects’ lifetimes.event_col (
str
) – Name of the column in anndata that contains the subjects’ death observation. If left as None, assume all individuals are uncensored.entry_col (
str
, default:None
) – Column denoting when a subject entered the study, i.e. left-truncation.
- Return type:
LogLogisticAFTFitter
- Returns:
Fitted LogLogisticAFTFitter.
Examples
>>> import ehrapy as ep >>> adata = ep.dt.mimic_2(encoded=False) >>> # Flip 'censor_fl' because 0 = death and 1 = censored >>> adata[:, ["censor_flg"]].X = np.where(adata[:, ["censor_flg"]].X == 0, 1, 0) >>> llf = ep.tl.log_logistic_aft(adata, "mort_day_censored", "censor_flg")