survival prediction

using the best encoded data to fit to our Lifelines WeibullAFT fitter.

Best Encoded Data

 Based on the previous section, we will now create our model using the best encoded data using Leave-One-Out encoder. We will fit the data to our Weibull AFT fitter and below is the summary of fitting the model.

weibull aft fitter summary

Ancillary=True, penalizer=0.001, 

Scale parameter (λ, lambda): This reflects the life expectancy of a component or system. It can be thought of as a measure of how long an item is expected to last before failure.

Shape parameter (ρ, rho): This describes the failure rate's behavior over time. If ρ > 1, the failure rate increases over time (typical of aging parts). If ρ < 1, the failure rate decreases over time, suggesting early failures are more common and the survivors have a lower rate of failure.

SURVIVAL FUNCTION

cumulative hazard

As we focus on understanding how different covariates affect the time until an event of interest occurs, the cumulative hazard function, while more abstract than the survival function, is related to the probability of survival over time and provides insights into the risk dynamics of the subjects under study. We've taken samples from our original dataset and plotted the model with rho and without rho which shows the same behaviour of our survival function. The cumulative hazard function itself doesn't directly predict time to event; instead, it gives a measure of the expected risk accumulation over time. 

WEIBULLAFT FITTER WITHOUT RHO

WEIBULLAFT FITTER WITH RHO

WEIBULLAFT FITTER WITH RHO APPLYING PENALTY (SURVIVAL & CUMULATIVE HAZARD)

The plot below compares the reaction of our model when applying penalty and can be used to fine-tune our model. Dashline(DF-2) indicates the model with penalty of 1e-4 and l1_ratio=0.10.

CHECKING THE BASELINE KM VS WEIBULL AFT FITTER

Early Convergence: The Weibull AFT model and the Kaplan-Meier estimate appear to be close to each other at the beginning of the timeline. This suggests that the Weibull model may be capturing the early risk period well.

Divergence Over Time: As time progresses, the Weibull AFT model survival function diverges from the Kaplan-Meier curve, staying relatively flat (near 1.0 survival probability) while the Kaplan-Meier curve shows a decline in survival probability. This divergence indicates that the Weibull AFT model may not be adequately capturing the risk of the event occurring as time increases.

Potential Overestimation of Survival: The Weibull AFT model seems to overestimate survival compared to the non-parametric Kaplan-Meier estimate, especially in the later time periods. This could be a sign that the model's assumptions are not fully consistent with the underlying data distribution or that the effect of covariates is not being captured accurately. This is proven when checking the content of the survival function dataframe by using this code:

# predict new survival function

wf.predict_survival_function(censored_subjects, conditional_after=censored_subjects_last_obs)


Aside from using AFT model, using a univariate parametric model, we tried to get the best model fit for our dataset and the most appropriate fitter is the piecewise exponential fitter. We then use the NelsonAalen fitter to plot the hazard rate against the best model which almost coincide with our data but gives us aggresive prediction of hazard rate approximately beyond 220 units.

PIECEWISE EXPONENTIAL FITTER WITH NelsonAalenFitter(Hazard Rate)

TESTING IF THE WEIBULL AFT FITTER IS FOR THIS DATASET

Weibull Q-Q Plot Analysis

The Weibull Q-Q plot provided should ideally show the empirical quantiles forming a straight line along the fitted Weibull quantiles if the data follows a Weibull distribution. In the plot, the points deviate significantly from the diagonal line, especially at the lower and higher ends of the data, indicating that the Weibull distribution may not be a good fit for our data.

Anderson-Darling Test Result

The Anderson-Darling test result shows a statistic of 110.897, which is considerably higher than the critical values at even the highest significance level listed. Since the test statistic is larger than the critical values, this suggests that we should reject the null hypothesis that the data comes from a Weibull distribution.

Kolmogorov-Smirnov Test Result

The Kolmogorov-Smirnov test gives us a KS statistic and a P-value. The KS statistic is quite high (0.8822), and the P-value is 0.0. A low P-value (typically below 0.05) indicates that the null hypothesis that the data comes from a Weibull distribution should be rejected.

Summary

Both the graphical method and the statistical tests suggest that the Weibull distribution may not be the best model for our data. The significant deviation in the Q-Q plot, along with the results from the Anderson-Darling and the Kolmogorov-Smirnov tests, strongly indicate a mismatch between the data and the Weibull distribution.

It is therefore recommended for this dataset to use the WeibullAFTFitter just to assess and mitigate the risk base on hazard and survival functions and not for prediction its remaining useful life. In this dataset, the Weibull functions can still be adapted in deep learning models but not for existing survival analysis models unless we create our custom regression model.

It is in this effect that Machine Learning (ML), Deep Learning(DL) and Ensemble Models have increasingly been applied and adapted to survival analysis, showcasing their ability to handle complex, multivariate datasets, including those with censoring and non-parametric distributions.