# multiclass classification with weights vs competing risks with censored data

I want to fit a machine learning model to a dataset which is basically a survival analysis with competing risks with several failure types (e.g. mortality causes). However, I want optimal predictions of either survival or of the specific failure types in order to draw conclusions about which predictors are most important to distinguish potential types of failure.

I have tried several methods and couldn't figure out how to do it in a sound way. One problem is that the different failure types have to a great extent similar predictors. For example age is a strong predictor for all failure types. If I run a survival random forest for competing risk almost all patients get assigned highest risk for the mortality cause with the highest incidence (so almost no separation). Similar results come up with cause-specific hazard modeling with boosted Cox (xgboost). I also expect that the same will come up with fine gray transformation (because you have to apply these methods once for every failure type and they just don't discriminate between censoring and a specific different failure type).

I also tried DeepHit but just couldn't get it to work (in part probably because the event rate is actually low, <30% die during the full follow up).

The best approach for me so far was a simple multiclass classification with xgboost (one class for surviving and one class for each type of failure). The problem here is that >60% of patients are censored before the end of the follow up time. So I would say although it is working (based on CIF graphs for the different failure types) it's statistically not as sound as I would like. To relieve the problem of missclassification of surviving patients due to censoring I additionally applied weights to surviving patients based on how long the patient was at risk before being censored. This gave me actually the best results in terms of separation of the different causes in CIF graphs.

My question is what the best way would be do this kind of analysis. And as a second question, whether this last method could be used or whether it is problematic.

Edit: I think a multi-state model as suggested by @EdM could be a solution here, is there a machine learning (e.g. tree-based, such as boosting) implementation for a setting with many predictors (I have >200 predictors)? Without understanding all the inner workings, the mentioned text by Therneau, Crowson and Atkinson mentions in the section 3.1 (for rate models):

The same Cox model coefficients can also be obtained by fitting separate models for the PCM and death endpoint, censoring cases that fail due to the other cause. Hazards can be computed one at a time. When computing p(t), on the other hand, all the rates must be considered at once, it is necessary to use the joint fit cfit1 above. We create predicted curves for four hypothetical subjects below.

Where p(t) is the probability for each state (e.g. cause of death) at time t. So if I understand it correctly a normal cause-specific hazard is calculated and from there the p(t), however I don't thinks this is the optimal approach with my dataset (as discussed above). Rather I think optimizing p(t) directly based on the available outcomes should optimize for variables most important to distinguish the different outcomes.

In Section 2 they present a competing risk model based on the Aalen-Johansen method. Not sure how this would perform. Is there a machine learning implementation of this method available?

• Please edit the question to specify the difficulty that you face. If you are modeling different causes of death, this could be a fairly simple extension of the 2-final-state competing risks Cox model, with separate coefficients for each cause, described in Section 3.1 of the vignette on multi-state Cox survival models in R. Is the problem specifically with your tree-based models, or a failure to distinguish coefficient estimates among death causes with all models including a traditional Cox competing-risk model?
– EdM
Apr 16, 2021 at 21:29
• @EdM thanks, I've updated the question. Is there a machine learning implementation of such multi-state Cox? Apr 18, 2021 at 9:16

With this approach and your simple state transitions you should get the same regression coefficients as you would get by doing separate models for each of the causes of death, just censoring cases at times of death from other causes. That won't, however, directly show you how deaths from different causes are distributed over time given specific covariate values, which is $$p(t)$$ in your situation and requires the combined modeling.
In terms of implementations via boosted models, a search on boosted multi state survival regression should provide several possibilities and links to the literature. This arXiv document reviews machine-learning approaches in survival modeling, including multi-state models. It also describes a general way to reduce survival analysis to a set of Poisson regressions amenable to machine learning.
In R, the gamboostMSM package combines the general boosting algorithms provided by the mboost package with Cox-type multi-state modeling. There is also a package CoxBoost in development that used to be available on CRAN but was removed recently due to failure to pass check results. I haven't used either of these myself, however.