# Risk factors affecting patients survival with colorectal cancer in Morocco: survival analysis using an interpretable machine learning approach

Imad El Badisy, Zineb Benbrahim, Mohamed Khalis, Soukaina Elansari, Youssef Elhitmi, Fouad Abbass, Nawfal Mellas, Karima El Rhazi

<figure><img src="image_1.png" /></figure>

## ► To cite this version:

Imad El Badisy, Zineb Benbrahim, Mohamed Khalis, Soukaina Elansari, Youssef Elhitmi, et al. Risk factors affecting patients survival with colorectal cancer in Morocco: survival analysis using an interpretable machine learning approach. Scientific Reports, 2024, 14 (1), pp.3556. 10.1038/s41598-024-51304-3. inserm-04999005

HAL Id: inserm-04999005

https://inserm.hal.science/inserm-04999005v1

Submitted on 20 Mar 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
<figure><img src="image_3.png" /></figure>

OPEN

# Risk factors affecting patients survival with colorectal cancer in Morocco: survival analysis using an interpretable machine learning approach

Imad El Badisy<sup>1,2,3✉</sup>, Zineb BenBrahim<sup>4</sup>, Mohamed Khalis<sup>1,2,6,7</sup>, Soukaina Elansari<sup>5</sup>, Youssef ElHitmi<sup>5</sup>, Fouad Abbass<sup>8</sup>, Nawfal Mellas<sup>5</sup> & Karima EL Rhazi<sup>8</sup>

The aim of our study was to assess the overall survival rates for colorectal cancer at 3 years and to identify associated strong prognostic factors among patients in Morocco through an interpretable machine learning approach. This approach is based on a fully non-parametric survival random forest (RSF), incorporating variable importance and partial dependence effects. The data was poved from a retrospective study of 343 patients diagnosed and followed at Hassan II University Hospital. Covariate selection was performed using the variable importance based on permutation and partial dependence plots were displayed to explore in depth the relationship between the estimated partial effect of a given predictor and survival rates. The predictive performance was measured by two metrics, the Concordance Index (C-index) and the Brier Score (BS). Overall survival rates at 1, 2 and 3 years were, respectively, 87% (SE = 0.02; CI-95% 0.84-0.91), 77% (SE = 0.02; CI-95% 0.73-0.82) and 60% (SE = 0.03; CI-95% 0.54-0.66). In the Cox model after adjustment for all covariates, sex, tumor differentiation had no significant effect on prognosis, but rather tumor site had a significant effect. The variable importance obtained from RSF strengthens that surgery, stage, insurance, residency, and age were the most important prognostic factors. The discriminative capacity of the Cox PH and RSF was, respectively, 0.771 and 0.798 for the C-index while the accuracy of the Cox PH and RSF was, respectively, 0.257 and 0.207 for the BS. This shows that RSF had both better discriminative capacity and predictive accuracy. Our results show that patients who are older than 70, living in rural areas, without health insurance, at a distant stage and who have not had surgery constitute a subgroup of patients with poor prognosis.

Colorectal cancer (CRC) is the 3rd most diagnosed cancer in the world, with more than 1.931 million new cases in 2020 worldwide and 4558 new cases in Morocco, representing almost 7.7 percent of all new cancer cases in the country¹. Several factors are significantly associated with the prognosis of CRC patients²⁻⁴. Whether these factors are related to patient characteristics, treatments, or even the healthcare system in general, it is essential to study their effects in order to develop a care strategy adapted to the local context.

Moreover, CRC imposes an economic burden that translates into direct medical expenses (cost of screening, hospitalization, treatment, transportation, etc.) and indirect expenses such as loss of productivity⁵⁻⁷.

¹Mohammed VI Center for Research and Innovation, Rabat, Morocco. ²International School of Public Health, Mohammed VI University of Sciences and Health, Casablanca, Morocco. ³INSERM, IRD, SESSTIM, Sciences Economiques & Sociales de la Santé & Traitement de l'Information Médicale, Aix Marseille Univ, Marseille, France. ⁴Faculty of Medicine, Pharmacy & Dental Medicine, Sidi Mohamed Ben Abdillah University, Fez, Morocco. ⁵Department of Oncology, University Hospital Hassan II, Sidi Mohamed Ben Abdillah University, Fez, Morocco. ⁶Higher Institute of Nursing Professions and Technical Health, Rabat, Morocco. ⁷Laboratory of Biostatistics, Clinical, and Epidemiological Research, Faculty of Medicine and Pharmacy, Department of Public Health, Mohamed V University, Rabat, Morocco. ⁸Laboratory of Epidemiology and Research in Health Sciences, Department of Epidemiology and Public Health, Faculty of Medicine of Fez, Sidi Mohamed Ben Abdillah University, Fez, Morocco. ⁹email: ielbadisy@um6ss.ma
Financial and insurance barriers have a major effect on the survival of patients with cancer. They are gener-
ally identified as directly related to health care utilization. For example, financial concerns have been found to
prevent uninsured people from seeking care unless they were in severe pain or thought they were going to die⁸,⁹.
In a study on CRC patients, 18% reported untreated rectal bleeding and 20% reported a change in bowel habit
but never sought medical attention. The main reason was that they did not consider this symptom to be serious¹⁰.

Furthermore, there is considerable epidemiological and observational evidence that the risk of CRC is closely
related to lifestyle, particularly diet and physical activity<sup>11-13</sup>.

CRC, being one of the leading causes of cancer-related deaths worldwide, presents intricate challenges to researchers and clinicians alike. Its multifaceted nature is evident in its diverse etiology, varied genetic mutations, and the influence of both internal and environmental factors on its progression. Patients with seemingly similar clinical presentations can have starkly different outcomes, making prognosis and treatment a challenging endeavor. In addition, the interplay between genetic factors, lifestyle choices, environmental exposures, and gut microbiota adds layers of complexity to the disease's understanding<sup>14</sup>. Conventional epidemiological methodologies frequently face challenges in effectively disentangling the intricate and interdependent factors involved in disease etiology. Therefore, there's a pressing need for sophisticated analytical tools that can sift through this complexity, discern patterns, and provide actionable insights to improve patient outcomes.

Advancements in precision medicine will necessitate more personalized prognostic evaluations for patients to guide appropriate treatments. Traditional statistical techniques for creating prognostic models involve substantial human input, encompassing the selection of prognostic factors based on disease understanding, variable manipulation and filling, and validating model assumptions¹⁵.

In this sense, machine learning provides a promising alternative to conventional statistical models, in iden-
tifying prognostic factors within vast and intricate datasets. Contrary to the standard approach of pre-selecting
prognostic factors grounded in disease understanding, machine learning employs a non-deterministic strategy,
letting the data itself uncover pivotal characteristics essential for precise predictions. This evolution from a
pre-determined selection to a data-driven exploration signifies a substantial shift in predictive and prognostic
modeling<sup>16,17</sup>.

Specifically, machine learning methods include automatic variable selection and non-parametric modeling strategies. These techniques can adeptly manage a multitude of predictors while making fewer presumptions about the relationships between particular variables and the desired outcomes. Consequently, such methodologies potentially reduce the extent of human input needed in crafting prognostic models¹⁸.

For instance, random survival forests can accommodate nonlinearities and interactions among variables. They are not confined to a uniform baseline hazard for all patients, circumventing the inherent assumption in Cox proportional hazards models¹⁹. Machine learning techniques can also make use of more data, which in different settings may give rise to further improved performance over conventional models. Also, variable selection allows its use in contexts where risk factors are unknown²⁰.

Furthermore, in the survival analysis framework, parametric models rest upon assumptions that might not be
upheld in real-world scenarios. The semi-parametric Cox proportional hazards models (Cox PH), for example,
operate under the assumption that changes in predictor variables lead to a multiplicative effect on the baseline
hazard during the period of observation²¹.

Additionally, addressing missing data requires a distinct approach, such as multiple imputation. Many impu-
tation methods assume that missing data occur randomly (missing at random). While this assumption holds in
many clinical settings, it's not always guaranteed, especially in prognostic studies²².

In an optimal research setting, a study based on the entire population would be the preferred approach,
providing a broad range of insights. However, due to limited resources and the lack of a nationwide informa-
tion system, using data from hospitals becomes necessary. While population-based data offers a lot of informa-
tion, hospital data has its own unique characteristics. Hospital datasets contain a variety of details, including
clinical information, biomarkers, and healthcare expenses²³.

This research focuses on a specific situation where various factors interact and affect the prognostic of CRC patients. The main goal of this study was to carefully explore the factors that shaped the risks, prognosis, and survival of CRC, particularly within the healthcare system of Morocco. As this investigation delves into the complex set of factors related to CRC and its various causes, its importance goes beyond just academic research. The significance of the study lies on its potential to provide practical insights that can guide specific healthcare policies and actions, thus filling gaps in healthcare delivery and improving patient outcomes. The aim of our study was to assess the overall survival rates for CRC at 3 years and to identify associated strong prognostic factors among patients in Morocco through an interpretable machine learning approach based on a fully non-parametric survival random forest with variable importance and partial dependence effects.

**Methods**

**Study design and data collection**

We performed a retrospective analysis of 343 patients diagnosed and followed at Hassan II University Hospital. The date of diagnosis of CRC indicated the start of the observation period. Patients were followed from January 2009 to January 2015 until death or censored at the end of the study. The end-point was set at 36 months from the date of diagnosis. All included patients were incident cases, whose dates of diagnoses occur within the active study period, ensuring that potential biases associated with disease duration prior to study entry were minimized. This approach, focusing exclusively on incident cases, effectively reduces the risk of biases related to left truncation censoring.

Data about patients' characteristics was extracted from the patients' medical records and supplemented
with an active follow-up to record vital status and observed survival times. Eligible patients had a histologically
confirmed diagnosis of CRC. Patients with histological types other than adenocarcinoma (N = 200) and diffuse lattice type (N = 50) were excluded. Similarly, patients with uninfomed medical records were removed (N = 150).

For each patient, information on sex, age, insurance, residency, delay to treatment, personal history, tumor site, stage, tumor differentiation, histological type, surgery, and MSI/MSS status, was extracted.

## Ethical considerations

This study, conducted under the strict observance of relevant guidelines and regulations, was retrospectively designed and only involved the collection of medical history data. Due to this retrospective nature, the requirement for informed consent was waived by the Local Ethics Committee of the Hassan II University Hospital of Fes. The approval for this study was granted by the aforementioned Ethics Committee, as attested by the reference number 05/18.

## Statistical analysis

A descriptive analysis of the study sample was conducted.

While multiple imputation remains as the gold standard in prognostic studies, its utilization is incompatible with machine learning algorithms. Specifically, multiple imputation requires the generation of a distribution for the missing values, and the subsequent estimation of multiple models of the missing data, with the results pooled using Rubin's rules. This process is feasible and attainable with regression models, as they yield coefficients of estimation, allowing the pooled coefficients and their standard errors to incorporate the uncertainty surrounding the missing data imputation.

However, since the majority of machine learning algorithms take a single dataset as input, the pooling procedure becomes challenging to implement. Confronted with this limitation, we adopted a method of single imputation. Single imputation of missing data was done using the missRanger algorithm. It implements an imputation approach based on the random forest algorithm combined with the predictive mean matching method$^{24,25}$. This is a non-parametric imputation method that makes no prior assumptions about the distribution of the data. It directly predicts missing values using a random forest trained on the observed parts of the dataset. The imputation is performed iteratively until a convergence criterion is reached.

Before settling on our final model based on single imputation, a comparison was conducted among the complete cases, multiple imputation relying on Random Forest (mice RF) with 10 datasets, and single imputation based on Random Forest (missRanger).

Overall survival rates (1, 2 and 3 years) and corresponding 95% CIs were calculated using the nonparametric Kaplan-Meier estimator$^{26}$. Statistical comparison of the survival curves was performed using the log-rank test when stratification was performed on categorical variables.

The Cox PH model and RSF were both used to identify factors that affect CRC patient survival in our study. The well-known Cox PH model was used to estimate the effect of prognostic factors on survival time. The Multivariate Cox PH model with all the potential baseline predictors was estimated in order to compute the hazard ratio (HR) and their associated 95% CIs$^{21}$. Baseline predictors were: sex, age, insurance, residency, delay to treatment, personal history, tumor site, stage, tumor differentiation, histological type, surgery, and MSI/MSS status.

Beyond the Kaplan-Meier estimator, the Cox PH model allows the inclusion of covariates, which is useful for refining the information on survival time. In this case, the statistical significance of the adjusted covariates on survival times is tested.

## Cox proportional hazard model

The Cox PH is a semi-parametric model with two components, one parametric related to predictor variables and another fully nonparametric related to the estimate of the survival function, which doesn't make any assumptions about the underlying distribution of survival times.

In practice, the Cox model is specified by a hazard function:

$$h(t) = h_0(t) \exp(\beta^T X_i)$$

where $h_0(t)$ is the risk function (i.e. instantaneous risk of death at inclusion). This risk function is modified by changes in survival time conditional on covariates $X_i = X_1, ..., X_p$ which is a vector of covariates that do not depend on time, and $\beta_i = \beta_1, ..., \beta_p$ is a vector of regression coefficients associated to $X_i$. The parameters of the vector $\beta_i$ are estimated by maximizing the partial true likelihood expressed as follows:

$$L(\beta) = \prod_{i=1}^{m} \frac{\exp(\beta^T X_i)}{\sum_{j \in R_i} \exp(\beta^T X_j)}$$

where $R_i$ is the set of subjects at risk at time $t_i$, either $y_i \ge t_i$.

Several approaches can be used for model selection. A simple method is to estimate a univariate regression model, then a multivariate model with all predictors statistically significant (p-value > $\alpha$, $\alpha$ = 0.05). However, this univariate statistical significance filtering approach does not take into account interactions between covariates.

Recognizing the multitude of statistical tools available, we implemented a comprehensive regression modeling strategy to evaluate the robustness of the final Cox PH model fitted. This included diagnostic checks for the proportionality of hazards, evaluation of linearity for continuous variables, and investigation into potential outliers or influential cases.

It should be noted that, upon identifying deviations from the Cox model hypotheses, we did not employ typical modifications such as stratification or the inclusion of time-dependent covariates. This was a deliberate
choice, aligning with our study's ultimate aim. Our primary objective was not to fine-tune the Cox PH model for optimal integrity and applicability, but rather to present an approach centered on the interpretability of a machine learning-based prognostic algorithm.

## Random survival forests

In order to identify the most influential predictors of survival outcome, we extended our data analysis by performing a RSF. The RSF is an extension of the classical random forest framework to right-censored observations¹¹,²⁷,²⁹.

The main advantage of this approach is that it does not require any restrictive assumptions on the distribution of the data, unlike the proportional hazard assumption for the Cox model³¹. As a first step, binary survival trees are developed using the bootstrap sampling procedure for all predictors included in the analysis, by recursive partitioning similar to CART³². Each bootstrap sample excludes about 37% of the out-of-bag (OOB) data used as an estimate of the predictive error. Then the log-rank test statistic is specified as the default dump rule for splitting survival trees³³.

The final forest set is calculated by averaging the end node statistics using the boosted Nelson-Aalen and Kaplan-Meier estimators²⁹.

## Variable importance

Another approach to covariate selection is the variable importance method (VIMP) based on permutation. With this method, the attributable prediction error of each predictor $X_i$ is calculated. This approach is defined by³⁴ as the difference in model predictive performance between datasets with and without permuted values for the associated variable.

Permutation-based VIMP as implemented in RSF permutes the OOB data of a variable and compares its OOB prediction error with the original one. The intuition behind this method is that large importance values indicate variables with strong predictive potential¹¹,²⁷,²⁸.

## Partial dependence plots (PDP)

Furthermore, PDP were displayed to explore in depth the relationship between the estimated partial effect of a given predictor and survival rates²⁹.

PDP can reveal the shape of the relationship between a covariate and the target variable. Its values are constructed by drawing a subset of patients at random and then predicting their survival with the random forest many times, while holding all the covariates constant except for the covariate for which we want to estimate its marginal effect. This gives risk curves for each individual in the subset, normalized by its mean to obtain a single risk curve. For categorical covariates, PDP gives the risk associated with a certain class given different values of the covariate³⁰. Only the final set of strong predictors obtained by the VIMP procedure was considered in our interpretation.

## Predictive accuracy

Finally, we evaluated the predictive performance of our two models, Cox PH and RSF. The predictive performance was measured by two metrics, the Concordance Index (C-index) and the Brier Score (BS). The C-index is the frequency of concordant pairs among all pairs of subjects. It can be used to assess and compare the discriminative power of a risk prediction survival model³⁵. A pair of patients (i, j) is called concordant if the risk of the predicted event by the model is lower for the patient who experiences event at a later time point.

$$C\text{-index} = \frac{\sum_{i,j} 1_{T_j < T_i} \cdot 1_{\eta_j > \eta_i} \cdot \delta_j}{\sum_{i,j} 1_{T_j < T_i} \cdot \delta_j}$$

with $\eta_i$ the risk score of a unit i and $1_{T_j < T_i} = 1$ if $T_j < T_i$ else 0 and $1_{\eta_j > \eta_i} = 1$ if $\eta_j > \eta_i$ else 0. C-index takes values between 0 and 1, with 1 corresponding to the best discriminative power of the model.

The BS is used to evaluate the accuracy of a predicted survival function given a vector of time t. This is an improved version of the prediction error at the time point using inverse probability weighting of the censoring³⁶.

$$BS(t) = \frac{1}{N} \sum_{i=1}^{N} \left[ \frac{(\hat{S}(t \lor z_i))^2}{\hat{G}(X_i)} \cdot I(X_i < t, \delta_i = 1) + \frac{(1 - \hat{S}(t \lor z_i))^2}{\hat{G}(t)} \cdot I(X_i \ge t) \right]$$

where t is the time point at which BS is calculated, N is the sample size, $x_i$ is the covariate corresponding to sample i; $S(\cdot)$ is the survival function predicted by the model and $\hat{G}(\cdot)$ is the survival function corresponding to censoring. BS take values between 0 and 1, with 0 the best possible value corresponding to the best predictive accuracy of the model.

All statistical analyses were performed using R³⁷. Specifically, Kaplan-Meier curves and cox models were computed using the survival package¹. The finalfit package³⁸ was used to display the univariate and multivariate cox regression tables. The survminer package³⁹,⁴⁰ was used to draw the KM curves. The missRanger package²⁴ was used to impute missing values from the original data set. The RandomForestSRC package⁴¹,⁴² was used to build random survival forests, perform variable importance and display PDP.
## Results

A total of 346 patients were included for analysis. Details of demographic characteristics are described in Table 1. Overall, 181 were female (52.31%), with a mean age of 56.5 years (SD = 13.4).

Table 2 describes the clinical characteristics of CRC patients. There was almost an equal proportion of patients with colon (N = 186, 53%) and rectum (N = 160, 47%) cancers. The left colon was the most common tumor subsite (143, 41.3%), followed by the inferior (84, 24.3%) and middle rectum (58, 16.8%). More than half of the patients were at a distant stage at the time of inclusion (189, 54.6%). Furthermore, the predominant histological type was mucinous (313, 90.5%).

Table 3 presents the overall survival rates at 1, 2 and 3 years, which are, respectively, 87% (SE = 0.02; CI-95% 0.84–0.91), 77% (SE = 0.02; CI-95% 0.73–0.82) and 60% (SE = 0.03; CI-95% 0.54–0.66).

The difference in the survival curve was statistically significant by sex (log-rank test, *p* < 0.0098). The difference was also statistically significant when the survival curve was stratified by stage (log-rank test, *p* = 0.0001). However, no statistical significant difference was observed when stratifying by site (log-rank test, *p* = 0.28) (Fig. 1).

Only MSI/MSS status, Delay and histological type had missing values, respectively, 4.6%, 2.89% and 0.28%.

## Cox proportional hazard models

The results of the multivariate Cox PH model illustrate significant disparities in mortality risks associated with surgical intervention, cancer stage, insurance status, residential location, and tumor location. Specifically, patients who did not have surgery were 3.21 times more likely to die (HR 3.21; CI 1.83–5.63; *p* < 0.001) than those who did, and those with a distant stage were 6.64 times more likely to die (HR 6.64; CI 2.80–15.72; *p* < 0.001). Patients with no health insurance had 2.85 times a higher risk of mortality (HR 2.85; CI 1.63–4.98; *p* < 0.001) than patients with health insurance. Similarly, patients living in rural areas had a 1.88 times greater risk of death (HR 1.88; CI 1.18–2.98; *p* < 0.001) compared to those living in urban areas. Besides, patients with a tumor in the rectum side had a 1.86 times greater risk of death (CI 1.21; 2.88; *p* = 0.005) than patients with a tumor in the colon side (Table 4).

After the sensitivity analysis performed by RSF, we decided to keep all predictors in the multivariate Cox PH model in order to preserve the interaction between covariates, while interpreting covariates that have a statistically significant effect in the Cox model, and the presence of their effect has been confirmed by the RSF.

## RSF variable importance

The RSF was fitted using the same covariates as in the Cox PH models. A variable importance permutation-based approach was used to identify the most important prognostic factors related to the overall survival of our group of patients, and confidence intervals were calculated using subsampling.

The variable importance obtained from RSF strengthens that surgery, stage, insurance, residency, and age were the most important prognostic factors (Fig. 2).

These results are in agreement with the results obtained from fitting the multivariate Cox PH model (Table 4), as far as statistical significant effects are concerned.

Figure 3 depicts PDP. For age, PDP shows that the survival rate increases from 18 to 30 years, decreases very slowly between 30 and 75 years, and drops after that age. For insurance, we observed a positive effect for the ‘Yes’ modality compared to the ‘No’ modality on the survival rate, with a relative difference of almost 15 percentage points. For residency, we observed a positive effect on the survival rate for the ‘Urban’ modality compared to the ‘Rural’ modality, with a relative difference of almost 9 percentage points. For the site, a positive effect on the survival rate for the ‘Colon’ modality compared to the ‘Rectum’ modality was shown, with a relative difference of almost 3 percentage points. Furthermore, the ‘Distant’ stage had a negative effect on the survival rate when compared to the ‘Local’ stage, with a relative difference of nearly 7 percentage points. For surgery, the ‘Yes’ modality had a positive effect on the survival rate compared to the ‘No’ modality, with a relative difference of almost 15 percentage points.

<table><caption>**Table 1.** Socio-demographic characteristics of CRC patients.</caption><thead><tr><th></th><th>Female<br>(N=181)</th><th>Male<br>(N=165)</th><th>Overall<br>(N=346)</th></tr></thead><tbody><tr><td>Age (years)</td><td></td><td></td><td></td></tr><tr><td>Mean (SD)</td><td>56.5 (13.4)</td><td>58.3 (15.3)</td><td>57.3 (14.3)</td></tr><tr><td>Median [Min, Max]</td><td>57.0 [23.0, 82.0]</td><td>59.0 [19.0, 89.0]</td><td>58.0 [19.0, 89.0]</td></tr><tr><td>Insurance</td><td></td><td></td><td></td></tr><tr><td>Yes</td><td>162 (89.5%)</td><td>151 (91.5%)</td><td>313 (90.5%)</td></tr><tr><td>No</td><td>19 (10.5%)</td><td>14 (8.5%)</td><td>33 (9.5%)</td></tr><tr><td>Residency</td><td></td><td></td><td></td></tr><tr><td>Urban</td><td>146 (80.7%)</td><td>133 (80.6%)</td><td>279 (80.6%)</td></tr><tr><td>Rural</td><td>35 (19.3%)</td><td>32 (19.4%)</td><td>67 (19.4%)</td></tr></tbody></table>
<table><caption>**Table 2.** Clinical characteristics of CRC patients.</caption><thead><tr><th></th><th>Colon<br>(N=186)</th><th>Rectum<br>(N=160)</th><th>Overall<br>(N=346)</th></tr></thead><tbody><tr><td>Delay to start treatment (days)</td><td></td><td></td><td></td></tr><tr><td>Mean (SD)</td><td>36.5 (51.7)</td><td>71.7 (72.9)</td><td>52.9 (64.8)</td></tr><tr><td>Median [Min, Max]</td><td>21.0 [0, 281]</td><td>53.0 [0, 503]</td><td>34.5 [0, 503]</td></tr><tr><td>Missing</td><td>6 (3.2%)</td><td>4 (2.5%)</td><td>10 (2.9%)</td></tr><tr><td>Personal history</td><td></td><td></td><td></td></tr><tr><td>No</td><td>179 (96.2%)</td><td>157 (98.1%)</td><td>336 (97.1%)</td></tr><tr><td>Yes</td><td>7 (3.8%)</td><td>3 (1.9%)</td><td>10 (2.9%)</td></tr><tr><td>Tumor differentiation</td><td></td><td></td><td></td></tr><tr><td>Moderately differentiated</td><td>66 (35.5%)</td><td>51 (31.9%)</td><td>117 (33.8%)</td></tr><tr><td>Undifferentiated</td><td>15 (8.1%)</td><td>11 (6.9%)</td><td>26 (7.5%)</td></tr><tr><td>Well differentiated</td><td>105 (56.5%)</td><td>98 (61.3%)</td><td>203 (58.7%)</td></tr><tr><td>Tumor subsite</td><td></td><td></td><td></td></tr><tr><td>Inferior rectum</td><td>0 (0%)</td><td>84 (52.5%)</td><td>84 (24.3%)</td></tr><tr><td>Left colon</td><td>143 (76.9%)</td><td>0 (0%)</td><td>143 (41.3%)</td></tr><tr><td>Middle rectum</td><td>0 (0%)</td><td>58 (36.3%)</td><td>58 (16.8%)</td></tr><tr><td>Right colon</td><td>34 (18.3%)</td><td>0 (0%)</td><td>34 (9.8%)</td></tr><tr><td>Superior rectal</td><td>0 (0%)</td><td>18 (11.3%)</td><td>18 (5.2%)</td></tr><tr><td>Transverse colon</td><td>9 (4.8%)</td><td>0 (0%)</td><td>9 (2.6%)</td></tr><tr><td>Stage</td><td></td><td></td><td></td></tr><tr><td>Local</td><td>52 (28.0%)</td><td>49 (30.6%)</td><td>101 (29.2%)</td></tr><tr><td>Regional</td><td>33 (17.7%)</td><td>23 (14.4%)</td><td>56 (16.2%)</td></tr><tr><td>Distant</td><td>101 (54.3%)</td><td>88 (55.0%)</td><td>189 (54.6%)</td></tr><tr><td>Histological type</td><td></td><td></td><td></td></tr><tr><td>Mucinous</td><td>164 (88.2%)</td><td>148 (92.5%)</td><td>312 (90.2%)</td></tr><tr><td>Adenocarcinoma</td><td>17 (9.1%)</td><td>7 (4.4%)</td><td>24 (6.9%)</td></tr><tr><td>Signet ring cell</td><td>4 (2.2%)</td><td>5 (3.1%)</td><td>9 (2.6%)</td></tr><tr><td>Missing</td><td>1 (0.5%)</td><td>0 (0%)</td><td>1 (0.3%)</td></tr><tr><td>Surgery</td><td></td><td></td><td></td></tr><tr><td>Yes</td><td>97 (52.2%)</td><td>88 (55.0%)</td><td>185 (53.5%)</td></tr><tr><td>No</td><td>89 (47.8%)</td><td>72 (45.0%)</td><td>161 (46.5%)</td></tr><tr><td>MSI/MSS Status</td><td></td><td></td><td></td></tr><tr><td>No</td><td>154 (82.8%)</td><td>152 (95.0%)</td><td>306 (88.4%)</td></tr><tr><td>Yes</td><td>20 (10.8%)</td><td>4 (2.5%)</td><td>24 (6.9%)</td></tr><tr><td>Missing</td><td>12 (6.5%)</td><td>4 (2.5%)</td><td>16 (4.6%)</td></tr><tr><td>RAS mutated</td><td></td><td></td><td></td></tr><tr><td>No</td><td>171 (91.9%)</td><td>153 (95.6%)</td><td>324 (93.6%)</td></tr><tr><td>Yes</td><td>7 (3.8%)</td><td>3 (1.9%)</td><td>10 (2.9%)</td></tr><tr><td>Missing</td><td>8 (4.3%)</td><td>4 (2.5%)</td><td>12 (3.5%)</td></tr></tbody></table>

<table><caption>**Table 3.** Overall survival rates at 1 year, 2 years and 3 years.</caption><thead><tr><th>Year</th><th>Survival rates</th><th>SE</th><th>95% CI-lower</th><th>95% CI-upper</th></tr></thead><tbody><tr><td>1 year</td><td>0.87</td><td>0.02</td><td>0.84</td><td>0.91</td></tr><tr><td>2 years</td><td>0.77</td><td>0.02</td><td>0.73</td><td>0.82</td></tr><tr><td>3 years</td><td>0.60</td><td>0.03</td><td>0.54</td><td>0.66</td></tr></tbody></table>

## Predictive performance

The predictive performance of the Cox PH and RSF was evaluated using the C-index and the Integrated BS. The discriminative capacity of the Cox PH and RSF was, respectively, 0.771 and 0.798 for the C-index. while the accuracy of the Cox PH and RSF were, respectively, 0.257 and 0.207 for the BS. This shows that RSF had both a better discriminative capacity and predictive accuracy (Fig. 4).
<figure><img src="image_4.png" /><figcaption>**Figure 1.** Kaplan-Meier survival curves.</figcaption></figure>

Discussion

CRC is one of the most common cancers diagnosed globally. However, due to earlier detection and more effec-
tive treatment, high-income countries have seen a significant decrease in CRC mortality over the past decades.
Personalizing treatment, focusing on high-risk patients, and improving access to health-care systems are critical
to achieving the best possible health outcome.

In Morocco, there are two Population-Based Cancer Registries (PBCR): one in Casablanca that covers about 12% of the national population (36 million people) and has 38 data sources, and another in Rabat that covers about 21% of the national population (642,000 people) and has 65 data sources<sup>43,44</sup>. But as it is known, PBCR make a trade-off between exhaustivity in terms of incidence and availability of variables about patients (i.e., prognostic factors). Therefore, the study of factors influencing survival times is a difficult exercise with this type of data. Nevertheless, we have attempted for the first time in Morocco to study the survival of CRC and associate it with both socio-demographic factors and histopathological characteristics.

We found only one Moroccan study in the literature on the effect of predictive factors, particularly surgery, on survival of patients with mid and low rectal aenocarcinoma⁴⁵. The overall survival rate at 3 years was found to be 82%. However, this survival rate should be viewed with caution due to the small sample size (81 patients) but also the specificity of the patients who had the same histological type.

The overall survival at 3 years observed in our cohort was 0.6 [SE = 0.03; CI 95% 0.54–0.66], which is close to the results found in the literature. In a meta-analysis conducted on individual studies done in Iran, the pooled 3 years survival rate estimated by a random effect model was 0.64 [CI 95% 0.59–0.7]<sup>12</sup>. This result is very close to the rate found by<sup>46</sup>, which is 70.67 [CI 95% 66.4–74.93] in EMRO countries.

The literature on prognostic factors for CRC is extremely rich<sup>47,48</sup>. Regarding age, our results reveal a high-risk period after 72 years and a low-risk period before 30 years (Fig. 3). This result is interesting because the majority
<table><caption>**Table 4.** Cox regression models.</caption><thead><tr><th>Label</th><th>Levels</th><th>All</th><th>HR (Complete Cases)</th><th>HR (missRanger)</th><th>HR (mice RF)</th></tr></thead><tbody><tr><td rowspan="2">Sex</td><td>Female</td><td>181 (52.3)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Male</td><td>165 (47.7)</td><td>1.73 (1.13-2.64, p=0.012)</td><td>1.46 (0.97-2.19, p=0.067)</td><td>1.47 (0.97-2.23, p=0.066)</td></tr><tr><td>Age</td><td>Mean (SD)</td><td>57.3 (14.3)</td><td>1.02 (1.00-1.03, p=0.044)</td><td>1.02 (1.00-1.03, p=0.032)</td><td>1.02 (1.00-1.03, p=0.033)</td></tr><tr><td>Delay</td><td>Mean (SD)</td><td>52.9 (64.8)</td><td>1.00 (0.99-1.00, p=0.193)</td><td>1.00 (1.00-1.00, p=0.237)</td><td>1.00 (0.99-1.00, p=0.187)</td></tr><tr><td rowspan="2">Insurance</td><td>No</td><td>33 (9.5)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Yes</td><td>313 (90.5)</td><td>0.38 (0.21-0.69, p=0.002)</td><td>0.35 (0.20-0.62, p&lt;0.001)</td><td>0.35 (0.20-0.62, p&lt;0.001)</td></tr><tr><td rowspan="2">Residency</td><td>Rural</td><td>67 (19.4)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Urban</td><td>279 (80.6)</td><td>0.44 (0.26-0.73, p=0.002)</td><td>0.53 (0.33-0.84, p=0.007)</td><td>0.53 (0.33-0.85, p=0.009)</td></tr><tr><td rowspan="2">Personal history</td><td>No</td><td>336 (97.1)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Yes</td><td>10 (2.9)</td><td>1.07 (0.25-4.54, p=0.930)</td><td>1.10 (0.26-4.66, p=0.894)</td><td>1.09 (0.25-4.70, p=0.909)</td></tr><tr><td rowspan="2">Site</td><td>Colon</td><td>186 (53.8)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Rectum</td><td>160 (46.2)</td><td>1.89 (1.19-3.01, p=0.007)</td><td>1.84 (1.19-2.84, p=0.006)</td><td>1.86 (1.19-2.89, p=0.007)</td></tr><tr><td rowspan="3">Stage</td><td>Distant</td><td>189 (54.6)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Local</td><td>101 (29.2)</td><td>0.16 (0.07-0.39, p&lt;0.001)</td><td>0.15 (0.06-0.36, p&lt;0.001)</td><td>0.15 (0.06-0.36, p&lt;0.001)</td></tr><tr><td>Regional</td><td>56 (16.2)</td><td>0.36 (0.15-0.85, p=0.020)</td><td>0.32 (0.13-0.74, p=0.008)</td><td>0.32 (0.13-0.76, p=0.010)</td></tr><tr><td rowspan="3">Tumor differentiation</td><td>Undifferentiated</td><td>117 (33.8)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Moderately differentiated</td><td>26 (7.5)</td><td>1.79 (0.68-4.74, p=0.238)</td><td>1.67 (0.69-4.07, p=0.259)</td><td>1.65 (0.67-4.06, p=0.274)</td></tr><tr><td>Well differentiated</td><td>203 (58.7)</td><td>0.87 (0.55-1.39, p=0.568)</td><td>0.90 (0.57-1.40, p=0.630)</td><td>0.89 (0.56-1.40, p=0.609)</td></tr><tr><td rowspan="3">Histological type</td><td>Mucinous</td><td>312 (90.4)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Adenocarcinoma</td><td>24 (7.0)</td><td>1.03 (0.37-2.83, p=0.955)</td><td>1.11 (0.44-2.77, p=0.830)</td><td>1.11 (0.44-2.82, p=0.821)</td></tr><tr><td>Signet ring cell</td><td>9 (2.6)</td><td>2.08 (0.48-9.12, p=0.330)</td><td>2.16 (0.52-8.93, p=0.288)</td><td>2.20 (0.52-9.29, p=0.280)</td></tr><tr><td rowspan="2">Surgery</td><td>No</td><td>161 (46.5)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Yes</td><td>185 (53.5)</td><td>0.29 (0.16-0.52, p&lt;0.001)</td><td>0.31 (0.18-0.55, p&lt;0.001)</td><td>0.31 (0.18-0.55, p&lt;0.001)</td></tr><tr><td rowspan="2">MSI.MSS status</td><td>No</td><td>306 (92.7)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Yes</td><td>24 (7.3)</td><td>0.98 (0.40-2.41, p=0.958)</td><td>1.06 (0.43-2.60, p=0.903)</td><td>1.03 (0.42-2.55, p=0.952)</td></tr><tr><td rowspan="2">Ras mutated</td><td>No</td><td>324 (97.0)</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Yes</td><td>10 (3.0)</td><td>0.92 (0.36-2.33, p=0.855)</td><td>0.83 (0.33-2.09, p=0.694)</td><td>0.78 (0.30-2.05, p=0.616)</td></tr></tbody></table>

of studies on CRC predictive factors use age as a categorical variable through-age groups, thus losing an estimate of their prognostic effect at age time points$^{47,49,50}$.

We also identified factors that are considered to be barriers to health care seeking for CRC patients. Our results reveal that health insurance, pathological stage, and surgery were the main prognostic factors. Age, residency, and site also have a significant impact on the predicted survival rate.

In fact, the health coverage of patients is a condition to their regular access to care and thus have an important impact on their survival probability after diagnosis. The influence of financial barriers affects perceptions of severity, importance, and attribution of symptoms. When patients believe they cannot afford treatment, they may be more likely to downplay the severity of their symptoms$^{51}$.

Patients must first detect and interpret CRC symptoms as requiring medical attention before approaching the health system. When this does not happen, it is referred to as an appraisal delay$^{51}$. Assessment delay is defined as the time between when patients first detects their symptoms and when they first disclose them to a health professional. This delay is even more important when patients do not have health insurance and access to care is difficult.

In addition, other factors such as geographical distance and unfavourable economic conditions may also delay diagnosis. In a study done on a large panel of patients, the risk of death increased significantly beyond 31 days from diagnosis to treatment interval$^{52}$. We found that living in a rural area has a negative effect on CRC survival. This is closely related to the large distance between the health care centers and the places of residence in rural areas.
<figure><img src="image_5.png" /><figcaption>**Figure 2.** Variable importance of random survival forest through permutation.</figcaption></figure>

Moreover, a prevention strategy based on the individual risk of CRC should be systematically adopted by health professionals⁵³. Primary prevention for the general population is important. However, in order to be more effective, it should be targeted at the high-risk population⁵⁴. Our results show that people aged 30 years or older, living in rural areas, without health insurance, at a distant stage and who have not had surgery, constitute a subgroup of patients with poor prognonsis. Therefore, screening programs should be offered systematically to those patients.

The good predictive performance of RSF is an interesting result, especially in the context of predicting prognostic factors. RSF are flexible and have no assumptions about the data in hand. Even though they are considered black-box models, the methodological development of interpretability techniques has made their results more intelligible. Therefore, they are a good alternative model for analyzing survival data for cancer studies⁵⁵,⁵⁶.

The RSF offers a fresh perspective and methodology in survival analysis, leveraging the power of ensemble machine learning. Unlike the classical Cox PH model, which assumes proportional hazards and relies heavily on predefined assumptions about variable relationships, RSF offers a more flexible approach. It inherently accounts for interactions between variables, non-linear effects, and complex relationships within the data without needing explicit specification. This adaptability and robustness make RSF particularly advantageous in handling intricate datasets where traditional methods might fall short. In this regard, the RSF model, being a tree-based ensemble non-parametric algorithm, can address the limitations of the Cox model while also identifying and ranking the most important variables affecting survival time⁵⁷.

It is necessary to combine several methods to ensure consistency of results. This is the case in our study. We combined conventional methods such as the Kaplan-Meier estimator and the Cox PH model with the RSF method and the PDP interpretation approach. The agreement between the methods used confirms the low degree of sensitivity of our results¹⁵. Even though in our case, the assumptions of the Cox model were no met (see supplementary_file.docx). As a result, we cannot draw definitive conclusions based on the Cox model in our case; however, we utilized it as a reference, a baseline model, in order to shed light on the value of a data-driven approach. This comparison allows us to underscore the potential enhancements a machine learning methodology can offer, especially when handling the complexity and volume of data typically encountered in electronic health records (EHR). It also provides a framework for evaluating the degree to which advanced analytical techniques can complement or surpass traditional statistical models in the realm of prognostic modeling.

This study acknowledges certain limitations that warrant consideration. Primarily, the assumptions of the Cox PH model, central to our analysis, were not fully met, limiting the validity of the Cox model results. Additionally, the absence of a preliminary simulation study to validate the Cox PH model and (RSF methods may limit the generalizability of our findings⁵⁸. Furthermore, challenges related to the sample size and potential selection bias, inherent in observational studies using EHR also impact our study. These factors, could influence the representativeness of our results, necessitating a cautions interpretation and highlighting areas for future research improvement. Our study is the first in Morocco based on an innovative and robust statistical approach. Thus, the sample studied was subjected to an important data quality verification work. Even if our data come from patient files, they have been completed if necessary by an actif follow-up reflecting more precision for the endpoint.

It is clear that our cohort recruited at Hassan II University Hospital cannot claim to be representative of the Moroccan population, but this will be improved in our future studies, where we intend to design a multicenter study to reflect the profile of Moroccan CRC patients as much as possible. Furthermore, adding data on the genetic profile of the included patients is an excellent way to obtain very revealing results⁵⁹.

Also, a clinical decision support platform for CRC is needed in order to make clinical information easily usable by practitioners. Unfortunately, we are limited by the retrospective nature of our study. Ideally, the physician should have access to such a tool at each suspicious consultation to predict a risk score of developing CRC in order to perform real-time clinical prevention. Besides, the risk of information bias is not totally discarded, especially for disadvantaged patients with difficulties accessing care.
<figure><img src="image_6.png" /><figcaption>**Figure 3.** Partial dependence plots.</figcaption></figure>

Conclusion

Our research has highlighted that the RSF approach demonstrates better performance in scenarios where the assumptions of the Cox PH model are not valid. Thus, it's more appropriate to view RSF as a better option when the Cox PH models's assumptions are challenged, rather than as universally superior. This highlight the
<figure><img src="image_7.png" /><figcaption>**Figure 4.** Predictive performance using C-index and BS.</figcaption></figure>

significance of choosing the right method based on the particular conditions and assumptions of each study.

Utilizing data-driven techniques not only streamlines the model-building process for researchers but also paves the way for the discovery of new predictors with substantial epidemiological importance. Intriguingly, these methods are not tethered to specific diseases, making them adaptable for studying conditions whose origins are not yet fully understood. Managing and addressing the multifaceted challenges of CRC requires more than just traditional therapeutic interventions. There's an imperative to embrace predictive and personalized medical strategies at policy-making levels for comprehensive and effective disease control.

To enhance the efficacy of such strategies, we must emphasize the preventable aspects of CRC and prioritize ensuring healthcare accessibility for the most susceptible sections of the population. Expanding health insurance coverage emerges as a pressing national requirement. Universal health coverage can significantly mitigate cancer risks by fostering an environment conducive to early detection and minimizing the financial burdens primarily affecting those with limited means.

From a methodological perspective, machine learning offers a transformative potential in prognostic studies. It facilitates the identification of complex relationships between predictors and outcomes, leading to intriguing epidemiological findings. In contrast, traditional methods often operate within deterministic boundaries.

In line with this research, the development of a clinical decision support system would be immensely beneficial. Such a system would empower clinicians to formulate prognoses in a more personalized and dynamic manner, aligning with the individualized needs of patients. By harnessing the insights from machine learning and predictive analytics, clinicians can make informed decisions, optimizing treatment pathways and potentially improving patient outcomes. This shift towards a data-driven, patient-centric approach is the future of medical prognosis and can redefine how we address the challenges of diseases like CRC in real-time clinical settings.

## Data availability

The dataset analysed during the current study is available in the figshare repository, accessible via this link: https://figshare.com/articles/dataset/dataset_CRC_Fes_csv/21821439.

Received: 2 January 2023; Accepted: 3 January 2024

Published online: 12 February 2024

## References

1. 504-Morocco-fact-sheets.pdf. https://gco.iarc.fr/today/data/factsheets/populations/504-morocco-fact-sheets.pdf. Accessed August 2022.

2. Bai, J., Zhang, X., Xiang, Z. X., Zhong, P. Y. & Xiong, B. Identification of prognostic immune-related signature predicting the overall survival for colorectal cancer. *Eur. Rev. Med. Pharmacol. Sci.* **24**(3), 1134–1141 (2020).

3. Lee, Y.-H. *et al*. Effect of length of time from diagnosis to treatment on colorectal cancer survival: A population-based study. *PLoS ONE* **14**(1), e0210465 (2019).

4. Mayer, M. Package 'missRanger'. *R Package* (2019).

5. Berraho, M. *et al*. Sociodemographic factors and delay in the diagnosis of cervical cancer in Morocco. *Pan Afr. Med. J.* **12**(1), 14 (2012).

6. Siminoff, L., Thomson, M. & Dumenci, L. Factors associated with delayed patient appraisal of colorectal cancer symptoms. *Psychos Oncology* **23**(9), 981–988 (2014).

7. Stekhoven, D. J. & Bühlmann, P. MissForest—non-parametric missing value imputation for mixed-type data. *Bioinformatics* **28**(1), 112–118 (2012).

8. Becker, G. Deadly inequality in the health care 'safety net': Uninsured ethnic minorities' struggle to live with life-threatening illnesses. *Med. Anthropol. Q.* **18**(2), 258–275 (2004).
9. Chow, Z. et al. Factors contributing to delay in specialist care after colorectal cancer diagnosis in Kentucky. *J. Surg. Res.* **259**, 420–430 (2021).

10. Courtney, R. J. et al. Current state of medical-advice-seeking behaviour for symptoms of colorectal cancer: Determinants of failure and delay in medical consultation. *Colorectal Dis.* **14**(5), e222-e229 (2012).

11. Breiman, L. Random forests. *Mach. Learn.* **45**(1), 5–32 (2001).

12. Magaji, B. A., Moy, F. M., Roslani, A. C. & Law, C. W. Survival rates and predictors of survival among colorectal cancer patients in a Malaysian tertiary hospital. *BMC Cancer* **17**(1), 1–8. https://doi.org/10.1186/s12885-017-3336-z (2017).

13. Nikbakht, H. A. et al. Survival rate of colorectal cancer in eastern mediterranean region countries: A systematic review and meta-analysis. *Cancer Control* **27**(1), 1–15. https://doi.org/10.1177/1073274820964146 (2020).

14. De Rosa, M. et al. The biological complexity of colorectal cancer: Insights into biomarkers for early detection and personalized care. *Therapeutic Adv. Gastroenterol.* **9**, 861–886 (2016).

15. Compton, C. C. Precision medicine core: Progress in prognostication—Populations to patients. *Ann. Surg. Oncol.* **25**, 349–350 (2018).

16. Steele, A. J., Denaxas, S. C., Shah, A. D., Hemingway, H. & Luscombe, N. M. Machine learning models in electronic health records can outperform conventional survival models for predicting patient mortality in coronary artery disease. *PLoS One* **13**(8), e0202344 (2018).

17. Collins, A. R. & Yao, Y. Machine learning approaches: Data integration for disease prediction and prognosis (2018).

18. van der Schaar, M. & Hemingway, H. Machine learning in prognosis research. Prognosis Res. Health Care (2019).

19. Weathers, B. & Cutler, R. Comparison of survival curves between cox proportional hazards, random forests, and conditional inference forests in survival analysis (2017).

20. Cruz, J. A. & Wishart, D. S. Applications of machine learning in cancer prediction and prognosis. *Cancer Inform.* **2**, 59–77 (2006).

21. Cox, D. R. Regression models and life-tables. *J. R. Stat. Soc. Ser. B (Methodol.)* **34**(2), 187–202 (1972).

22. Herring, A. H. et al. Non-ignorable missing covariate data in survival analysis: A case-study of an International Breast Cancer Study Group trial. *J. R. Stat. Soc. Ser. C (Appl. Stat.)* **53**, 293–310 (2004).

23. Apte, M. et al. Using electronically available inpatient hospital data for research. *Clin. Transl. Sci.* **4**, 338–345 (2011).

24. Miao, F., Cai, Y.-P., Zhang, Y.-X., Li, Y. & Zhang, Y.-T. Risk prediction of one-year mortality in patients with cardiac arrhythmias using random survival forest. *Comput. Math. Methods Med.* 2015 (2015).

25. Tazi, M. A., Er-Raki, A. & Benjaafar, N. Cancer Incidence in Rabat, Morocco: 2006–2008. *Ecancermedicalscience* **7**, 338 (2013).

26. Kaplan, E. L. & Meier, P. Nonparametric estimation from incomplete observations. *J. Am. Stat. Assoc.* **53**(282), 457–481 (1958).

27. Breiman, L. Bagging predictors. *Mach. Learn.* **24**(2), 123–140 (1996).

28. Ishwaran, H. & Min, Lu. Standard errors and confidence intervals for variable importance in random forest regression, classification, and survival. *Stat. Med.* **38**(4), 558–582 (2019).

29. Ishwaran, H., Kogalur, U. B., Blackstone, E. H. & Lauer, M. S. Random survival forests. *Ann. Appl. Stat.* **2**(3), 841–860 (2008).

30. Ishwaran, H., Lu, M. & Kogalur, U. B. randomForestSRC: Partial Plots Vignette. http://randomforestsrc.org/articles/partial.html (2021).

31. Murphy, N. et al. Lifestyle and dietary environmental factors in colorectal cancer susceptibility. *Mol. Asp. Med.* **69**, 2–9 (2019).

32. Crawford, S. L. Extensions to the CART algorithm. *Int. J. Man-Mach. Stud.* **31**(2), 197–217 (1989).

33. Ciampi, A., Negassa, A. & Lou, Z. Tree-structured prediction for censored survival data and the cox model. *J. Clin. Epidemiol.* **48**(5), 675–689 (1995).

34. Fisher, A., Rudin, C. & Dominici, F. All models are wrong, but many are useful: Learning a variable's importance by studying an entire class of prediction models simultaneously. *J. Mach. Learn. Res.* **20**(177), 1–81 (2019).

35. Harrell, F. E., Califf, R. M., Pryor, D. B., Lee, K. L. & Rosati, R. A. Evaluating the yield of medical tests. *JAMA* **247**(18), 2543–2546 (1982).

36. Graf, E., Schmoor, C., Sauerbrei, W. & Schumacher, M. Assessment and comparison of prognostic classification schemes for survival data. *Stat. Med.* **18**(17–18), 2529–2545 (1999).

37. Roncucci, L. & Mariani, F. Prevention of colorectal cancer: How many tools do we have in our basket?. *Eur. J. Internal Med.* **26**(10), 752–756 (2015).

38. Harrison, E., Drake, T., Ots, R. & Harrison, M. E. Package 'Finalfit'. (2020).

39. Kassambara, A., Kosinski, M., Biecek, P. & Fabian, S. Package 'Survminer'. *Drawing Survival Curves Using "Ggplot2" (R Package Version 03 1)* (2017).

40. Lee, C. H. et al. The risk factors affecting survival in colorectal cancer in Taiwan. *Iran. J. Public Health* **47**(4), 519–530 (2018).

41. Ishwaran, H. & Kogalur, U. B. Package 'randomForestSRC': Breast **6**, 1 (2022).

42. Ishwaran, H., Lauer, M. S., Blackstone, E. H., Lu, M. & Kogalur, U. B. randomForestSRC: Random Survival Forests Vignette. http://randomforestsrc.org/articles/survival.html (2021).

43. Bouchbika, Z. et al. Cancer incidence in Morocco: Report from Casablanca Registry 2005–2007. *Pan Afr. Med. J.* **16**(1), 31 (2014).

44. Volovici, V. et al. Steps to avoid overuse and misuse of machine learning in clinical research. *Nat. Med.* **28**, 1–4 (2022).

45. Essangri, H. et al. Predictive factors of oncological and survival outcome of surgery on mid and low rectal adenocarcinoma in Morocco: Single center study. *J. Med. Surg. Res.* **6**, 627–635 (2019).

46. Omurlu, I. K., Ture, M. & Tokatli, F. The comparisons of random survival forests and cox regression analysis with simulation and an application related to breast cancer. *Expert Syst. Appl.* **36**(4), 8582–8588 (2009).

47. Atinafu, B. T., Bulti, F. A. & Demelew, T. M. Survival status and predictors of mortality among colorectal cancer patients in Tikur Anbessa specialized hospital, Addis Ababa, Ethiopia: A retrospective followup study. *J. Cancer Prevent.* **25**(1), 38 (2020).

48. R Core Team. *R: A Language and Environment for Statistical Computing*. R Foundation for Statistical Computing. https://www.R-project.org/ (2021)

49. Lee, C.-H. et al. The risk factors affecting survival in colorectal cancer in Taiwan. *Iran. J. Public Health* **47**(4), 519 (2018).

50. Farhat, W. et al. Factors predicting recurrence after curative resection for rectal cancer: A 16-year study. *World J. Surg. Oncol.* **17**(1), 1–10 (2019).

51. Sung, H. et al. Global cancer statistics 2020: GLOBOCAN estimates of incidence and mortality worldwide for 36 cancers in 185 countries. *CA A Cancer J. Clin.* **71**(3), 209–249 (2021).

52. Louppe, G., Wehenkel, L., Sutera, A. & Geurts, P. Understanding variable importances in forests of randomized trees. In *Advances in Neural Information Processing Systems* **26** (2013).

53. Sharma, R. An examination of colorectal cancer burden by socioeconomic status: Evidence from GLOBOCAN 2018. *EPMA J.* **11**(1), 95–117 (2020).

54. Giovannucci, E. Modifiable risk factors for colon cancer. *Gastroenterol. Clin.* **31**(4), 925–943 (2002).

55. Mogensen, U. B., Ishwaran, H. & Gerds, T. A. Evaluating random forests for survival analysis using prediction error curves. *J. Stat. Softw.* **50**(11), 1 (2012).

56. Ortiz-Ortiz, K. J., Ríos-Motta, R., Marín-Centeno, H., Cruz-Correa, M. & Ortiz, A. P. Factors associated with late stage at diagnosis among Puerto Rico's government health plan colorectal cancer patients: A cross-sectional study. *BMC Health Serv. Res.* **16**(1), 1–10 (2016).
57. Farhadian, M., DehdarKarsidani, S., Mozayanimonfared, A. & Mahjub, H. Risk factors associated with major adverse cardiac and cerebrovascular events following percutaneous coronary intervention: A 10-year follow-up comparing random survival forest and Cox proportional-hazards model. *BMC Cardiovasc. Disord.* **21**, 1–8 (2021).

58. Smith, H., Sweeting, M., Morris, T. & Crowther, M. J. A scoping methodological review of simulation studies comparing statistical and machine learning approaches to risk prediction for time-to-event data. *Diagn. Prognostic Res.* **6**(1), 1–15 (2022).

59. Carr, P. R. et al. Healthy lifestyle factors associated with lower risk of colorectal cancer irrespective of genetic risk. *Gastroenterology* **155**(6), 1805–1815 (2018).

## Acknowledgements

Thanks to all contributors who participated in the conception and design of the study, to those who ensured the quality of the data and the active follow-up of the patients. IE was supported by ROCHE Morocco.

## Author contributions

The authors confirm contribution to the paper as follows: study conception and design: K.R., F.A., M.K., N.M.; data collection: F.A., Z.B., S.E., Y.E.; analysis and interpretation of results: I.E., Z.B., K.R., M.K.; draft manuscript preparation: I.E. All authors reviewed the results and approved the final version of the manuscript.

## Funding

This protocol research is funded by Moffitt Cancer Center under the NIH International Fogarty Center for the Award Number 5D43TW009804, PI Anna Giuliano.

## Competing interests

The authors declare no competing interests.

## Additional information

**Supplementary Information** The online version contains supplementary material available at https://doi.org/10.1038/s41598-024-51304-3.

Correspondence and requests for materials should be addressed to I.E.B.

Reprints and permissions information is available at www.nature.com/reprints.

**Publisher's note** Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

<figure><img src="image_8.png" /></figure>

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

© The Author(s) 2024, corrected publication 2024