Machine Learning Framework for Longitudinal Functional Decline and Time-to-Event Prediction | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Article Machine Learning Framework for Longitudinal Functional Decline and Time-to-Event Prediction Juan A. Delgado-SanMartin, Varsha Gupta, Harry E. McDonough, Siying Jane Ong, and 2 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6717675/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Harnessing longitudinal data for time to event analysis can provide valuable insights into disease progression and help plan clinical interventions for individual patients, with the goal of improving clinical outcomes and quality of life. However, real-world clinical data is characterised by missingness, inconsistencies and heterogeneity, especially when datasets are aggregated from different sources. Here, we propose a robust methodological framework to tackle the above challenges and apply it to time to gastrostomy prediction for amyotrophic lateral sclerosis (ALS) patients. Data from 8,586 ALS patients were extracted from three independent cohorts. We determined classes for time-dependent measures of patient decline using joint latent class growth analysis–discrete time survival analysis (LCGA-DTSA). For new patients, individual trajectories of functional decline were mapped using Fréchet distances. Survival and machine learning approaches (Cox Proportinal Hazards, Cox XGBoost, and XGboost Pseudo-Observation Regression) using baseline and longitudinal features were evaluated for predicting time-to-gastrostomy. The best-performing time-to-gastrostomy model was integrated with a time-to-death survival model to provide an overall confidence label. We found that the joint LCGA-DTSA enables clear patient stratification by functional decline. The prediction models indicated that rapid decline classes for ALSFRS-R (ALS Functional Rating Scale Revised) bulbar subscore and swallow function are the most important factors determining time-to-gastrostomy insertion. Further, we determined that XGBoost MAEPO model applied on longitudinal features extracted via LCGA-DTSA algorithms outperform every other model in absolute error terms, whilst still providing strong concordance index. Predictions are accompanied with a percentage confidence describing the likelihood of gastrostomy insertion happening given predicted survival time. Longitudinal trajectories of functional decline can contain crucial information for time-to-event prediction. For declining conditions, such as ALS, appropriate integration of time-to-intervention models with overall survival models could also help inform clinical care and shared decision-making. Biological sciences/Neuroscience/Diseases of the nervous system/Amyotrophic lateral sclerosis Health sciences/Medical research/Outcomes research Physical sciences/Mathematics and computing Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Introduction Clinical data exhibits inherent messiness characterised by missingness, inconsistencies, and heterogeneity. Integrating longitudinal and baseline features is particularly challenging 1 especially when variables are sourced from aggregated datasets across disparate hospitals and localities. Survival models face limitations in accurately predicting the exact time of an event, particularly when data is heavily censored. 2 – 7 Further, when events are sparsely distributed over time, the model's ability to learn precise time predictions is particularly diminished when using conventional survival modelling. 8 Its limited success is partially due ignoring longitudinal measures of health decline. Over the course of many degenerative diseases, patients may need supportive clinical interventions. Being able to predict when patients need these interventions would help in care planning. One such disease with this need is amyotrophic lateral sclerosis (ALS), a fatal neurodegenerative disorder affecting motor neurons that results in progressive muscle weakness, with death most commonly secondary to respiratory failure. 9 The progression of ALS is, however, considerably heterogeneous, impacted by phenotypic and genetic factors. 10 This variability makes it challenging for clinicians to predict when patients may need clinical interventions, such as a gastrostomy. Early insertion of a gastrostomy tube to avoid continued weight loss is known to be prognostically important, both in ALS 11 and other conditions, such as head and neck cancers. 12 In this study, we look to tackle the challenges of utilising clinical data in time-to-event prediction, describing a framework for modelling the longitudinal changes in clinical biomarkers and using these to predict the time to clinical intervention using trajectories of functional decline (Fig. 1 A). We compare the longitudinal trajectories as features and compare them to baseline clinical measures (Fig. 1 B). Methods Data preprocessing Data were separated into static and longitudinal variables, with duplicate values removed. Descriptors of clinical factors were standardised across data sources to align terminology. Data on longitudinal variables with repeated measures were anchored to a standardised timescale, with day 0 defined as the day of symptom onset. Thereafter, data were aligned into 30-day intervals, with up to three years of follow-up data utilised. Finally, the ALSFRS-R slope, a known predictor of the rate of ALS progression, was computed, as described previously. 13 Data were not otherwise transformed or reduced in dimensionality. Modelling trajectories of functional decline For classification of trajectories using joint latent class growth analysis-discrete time survival analysis model (LCGA-DTSA), 14 – 16 we used the four longitudinal functional decline markers from the patients who had at least three timepoints from time of onset. We assumed maximum values of these markers at the time of onset of 48 for ALSFRS-R total score, 12 for bulbar subscore, 4 for swallow function (Q3) and 100% for respiratory function/VC, which gave us four timepoints. We then estimated the discrete factor \(\:{\prime\:}f{\prime\:}\) . For that, the three-year study follow-up period was divided into twelve equal intervals of 90 days, labelled \(\:{u}_{1}\:to\:{u}_{12}\) , where each \(\:{u}_{i}\) is binary and represents gastrostomy insertion. Missing values correspond to censoring information, i.e. death or loss of follow up. We then constructed a factor \(\:{\prime\:}f{\prime\:}\) from these discretised times ( \(\:{u}_{i}\) ) (Table S3). 17 To address data sparsity, we performed a quadratic polynomial fit for each discretised 90 day interval until time to event (Figure S3). The estimated trajectories from quadratic polynomials and the discrete factor \(\:‘f’\) were used to perform joint latent class growth analysis–discrete time survival analysis model LCGA-DTSA 14 – 16 in MPLUS (Figure S3). The joint modelling approach enabled identification of distinct patient functional decline trajectory groups mapping to ranked survival trajectory groups. The decision on the number of classes was made based on Bayesian Information Criterion, entropy of classification, posterior probability of belonging to a class and the overlap of 95% confidence intervals of trajectories and the survival curves (generated in Matlab using \(\:‘ecdf’\) for \(\:‘survivor’\) functions). Feature sets for time-to-gastrostomy modelling We juxtapose two feature sets: the Baseline set was composed of 8 features (sex, age at onset, site of onset, presence of C9orf72, El Escorial , ALS Phenotype, respiratory function in terms of vital capacity (VC), and diagnostic delay) and the Longitudinal set was composed of 4 + 3 = 7 features (4 functional decline classes extracted via joint LCGA -DTSA , and 3 additional: 5% Weight loss class, ALSFRS-R initial slope, and Bulbar initial slope). Mapping new patients to classes via Fréchet distances We used the functional decline classes defined through LCGA-DTSA as another feature set. Because of the non-parametric nature of LCGA-DTSA, the classes of new patients are mapped using Fréchet distances, 18 taking the minimum Fréchet distance for each collection of points belonging to one patient as the chosen class. Formally, let us define the collection of input points as \(\:P\) and the closest point to the exponential decay function of each class \(\:c\) evaluated at each \(\:t\) contained in \(\:P\) . We can then calculate a Fréchet distance for each class \(\:c\) , with a relative weight based on the absolute value of the Fréchet distance, see Figure S4. We map the data with insufficient points as illustrated in Figure S1 (n = 2,675) using this method. Estimating weight loss trajectory classes Alongside the functional decline classes, we defined a weight loss class corresponding to 5% weight loss from baseline, which corresponds to lower fat mass associated to faster disease progression. 19 We observed in this cohort that weight does not deteriorate continuously from onset, rather it remains constant after the disease onset and, only after a time lag, starts to deteriorate. In the training dataset retrospectively, we defined two factors to define this: (i) a binary parameter to mark 5% weight loss in patients: 1 if patient lost ≥ 5%, 0 otherwise, 11 (ii) time from onset at which this loss happens, see Figure S5 for individual trajectories and Figure S6 for the groups trajectories. Baseline features We compare the longitudinal results with static features normally collected around the time to diagnosis. These features are sex, site of onset (spinal vs bulbar), age at onset, diagnostic delay (time from symptom onset to diagnosis), forced vital capacity (FVC; percentage of predicted based on normative values for age, sex, and body height), El Escorial, and presence of a C9orf72 mutation. Longitudinal features We grouped together all longitudinal features: functional decline classes, weight loss classes, progression rate defined by the slope on the revised ALS Functional Rating Scale (ALSFRS-R), and the slope on bulbar function. For the functional decline and weight loss classes, after inferring the class belonging, we sampled every 90 days from a normal distribution with mean defined as the exponential decline fit of each class and with the standard deviation from the training set. This produces 13 feature columns per class providing a projection of functional decline. Prediction models for time-to-event To build our time prediction framework for time-to-event (gastrostomy insertion), we considered the following survival and regression models: COX Linear (proportional hazards), COX XGBoost survival model (see eqs. SA1-2 in Appendix A), 20 and XGBoost regression with pseudo-observations, 21 described as a regression model where the variable to be predicted is time to gastrostomy. We also compare the results to a naïve 10% weight loss model, which has been linked to 23% increase in mortality rate. 22 , 23 Because most of our data (75%) is censored, i.e. gastrostomy did not happen before death or loss of follow-up, we calculated pseudo-observations for all censored data using the method defined in Qi et al. (NB: we adapted their original equation). 21 Let us define the time of pseudo-observation as: $$\:{t}_{PO,i}=\left(1-{\delta\:}_{i}\right)\cdot\:{e}_{margin}\left({t}_{i}\right)+{t}_{i}$$ 1 , where the \(\:{\delta\:}_{i}\) is a Dirac delta representing the event, \(\:{e}_{margin}\left({t}_{i}\right)\) an error margin based on the censored data, and \(\:{t}_{i}\) the time of censored patient. Now we define the error margin as $$\:{e}_{margin}\left({t}_{i},\mathcal{D}\right)=N\cdot\:\widehat{\theta\:}-\left(N-1\right)\cdot\:{\widehat{\theta\:}}^{-i}$$ 2 , Where \(\:N\) is the number of patients, \(\:\widehat{\theta\:}\) is an unbiased estimator of the entire population survival ( \(\:\mathcal{D}\) ) and \(\:{\widehat{\theta\:}}^{-i}\) is missing the observation \(\:i\) . Once defined the pseudo-observations, we used weighted least squares approximation: $$\:{\Phi\:}=\sum\:2\cdot\:{w}_{i}\cdot\:({t}_{PO,i}\:-\:{\widehat{t}}_{i})$$ 3 , where \(\:{\Phi\:}\) is the objective function, \(\:{\widehat{t}}_{i}\) is the predicted times by the model, weights are defined as \(\:{w}_{i}={t}_{i}^{S}\) , S being a sigmodal, \(\:S=\frac{2}{1+exp\left(\frac{y-\beta\:}{\alpha\:}\right)}\) to penalise overestimations at earlier timepoints. Note that we chose these values after a few tests revealing that the best values were \(\:\alpha\:=365\cdot\:3,\:\beta\:=365\) . These values can be estimated in other ways too. Following the objective function definition Eq. ( 3 ), we chose mean absolute error (MAE) as the intrinsic validation metric, defined as: $$\:MA{E}_{PO}=\frac{1}{N}\sum\:\left|{t}_{PO,i}-{\widehat{t}}_{i}\right|$$ 4 . Defining labels to integrate time-to-event and survival model predictions Since patients may die before needing the intervention (event), we characterised the risk of death using a previously published survival model for ALS. 24 , 25 We assign a confidence level by running the gastrostomy and overall survival models on the same patients and comparing both predicted times. For that, we trained a logistic regression and compared it to two naïve models: a simple diagonal splitter which divides the data into: death is predicted to happen before gastrostomy or gastrostomy happens before death; and a model where the data is divided into patients who experienced 10% weight loss and those who did not. Model training and evaluation We performed a nested cross validation for Bayesian hyperparameter optimisation using Optuna. The external cross validation had three folds (k = 3) (one per database) and the internal had k = 5 folds stratified by database and split randomly from the training set into training and validation set at a ratio of 70/30. We allowed for five hyperparameter trials starting from random positions. In total we computed 75 optimisations. The evaluation metrics used are Uno’s Concordance Index and Median Absolute Error ( \(\:MedianAE\) ) on the uncensored data. Note that all metrics are evaluated on true observations and not pseudo-observations. We performed Permutation Feature Importance and a series of sensitivity analyses which included effect of data missingness at random and model resilience to missingness of longitudinal measurements. The 95% confidence intervals for each variable have been estimated using Bootstrapping on 100 simulations of 80% samples on the external validation set. Software & Hardware Data engineering was done in pandas (python 3.11), LCGA-DTSA analysis done in MPLUS v8.8 and Matlab v2023b, time to gastrostomy prediction & the backend of the web app in python 3.11.6 using pandas, scikit-learn, XGBoost, Altair. The frontend was done in HTML/JS and deployed as a monolithic application to Google Cloud’s AppEngine. Hardware used was 96Gb RAM MacOS15 on M3 MacBookMax 2024. Ethical approval Local ethical approval was sought and granted for access to the ArQ database (STH18103). Access to PRO-ACT was approved by members of the PRO-ACT Consortium, with an ethical statement from the consortium available online. 26 Access to the IDPP dataset was given to author DW as part of the IDPP@CLEF 2022 Brainteaser challenge; further information regarding access to the IDPP dataset is available online. 27 Results Classification of functional decline for patient stratification The joint latent class growth analysis–discrete time survival analysis model revealed four functional decline classes in cases of ALSFRS-R, bulbar subscore and three classes in case of swallowing function (Q3) and respiratory function, see Figure 2 . In all cases, the optimum number of classes corresponded to Entropy≥0.898, non-overlapping 95% confidence interval of both for trajectories and the survival curves of gastrostomy, and the mean posterior probability of belonging to the respective classes was ≥0.953 (supplementary Table S4). Figure 2 shows classes of trajectories for each variable and the corresponding gastrostomy probabilities. Using unsupervised LCGA-DSTA model, four trajectory classes were identified in ALSFRS-R total score, namely, very slow (n=2,392), slow (n=2,266), medium (n=956) and fast (n=93). It can be observed that the mean score increases towards the end of trajectories. This is because those with lower scores die sooner, leaving patients who live longer and, thus, have higher functional scores. Similarly, four trajectory patterns in the bulbar subscore corresponded to slow (n=3,302), slow-medium (n=176), whereby a small number of patients had slow decline till day ~400 and then declined with a similar slope to the medium trajectory (n=1,410). The fast decline trajectory in the bulbar subscore had 567 patients and highest probability of gastrostomy. The three trajectory patterns observed in swallowing function (Q3) were slow (n=3,439), medium (n=1,473) and fast (n=543). Similarly, respiratory function patterns corresponded to slow (n=774), medium (n=1,560) and fast (n=618). In the case of weight loss, the classes were derived by defining a 5% loss from baseline with two classes: loss (n=2,267, fast) or no-loss (n=4,044, medium) see Figure S6. The most rapid decline classes (marked as ‘fast’) showed that swallow function and bulbar score declines are the most crucial with means of 16-18 months to reach 0.5 probability of gastrostomy (see Figure S7). Mapping the remaining patients (those with fewer than four longitudinal points) using Fréchet distances revealed higher mapping accuracies (75%) for features with three classes compared to those with four classes (60%), see Figure S8. Predicting time-to-event We investigated three main models: XGBoost with MAEPO regression, XGBoost with Cox Survival and Linear Cox survival model, and compared them to a weight-only naïve classifier. The naïve classifier assumes 10% weight loss from baseline is the criterion for gastrostomy insertion. In Figure 3A, we show the results of our best performing model (XGBoost with MAEPO regression) trained on individual features, showing that the bulbar and ALSFRS-R decline slopes alongside the Q3 and bulbar functional decline classes have the most predictive potential. We then compared all three models and the weight naïve model using two feature sets: longitudinal and the baseline. The performance metrics show that the longitudinal set outperforms in every case the baseline set. Noticeably, although the best performing model is our proposed XGBoost MAEPO model, the XGBoost Cox Survival model shows superior results in Concordance index in some cases (Figure 3B). The worst model was the linear Cox Proportional Hazards model. In any case, all models comfortably outperform the weight naïve classifier, which represents the decision criterion clinicians often use for gastrostomy need assessment. In terms of the databases, all test rotations showed acceptable results. The best classifier (XGBoost MAEPO + longitudinal features, testing on ArQ) achieved concordance indices of 0.739 (IQR, 0.724-0.754) and median absolute error of 193 (186-200) days. In comparison, the best survival classifier (XGBoost Cox + longitudinal features, testing on ArQ) achieved median concordance indices of 0.766 (0.753-0.778) but median absolute error of 295 (IQR, 278-311) days. Although the XGBoost Cox model demonstrated a slight improvement of 0.027 points in concordance index relative to the XGBoost MAEPO model, this was offset by the 102-day increase in median absolute error, ultimately resulting in a weaker overall predictive capability. Lastly, absolute error over time shows stability for longitudinal features after four months, while baseline features exhibit higher error that gradually decreases throughout the three-year period (Figure 3C), also corroborated by the individual prediction bias plot (Figure S9). Numeric results of all estimations are captured in the Supplementary Materials. A test using Multiple Imputation by Chained Reactions (MICE) was carried out to understand its potential use. Results show a modest increase in performance, particularly in the baseline set (Figure S10). 28 Due to the associated risks of introducing artificial bias, imputation was discouraged in this study. An evaluation of prediction performance across varying tolerance levels revealed that our XGBoostMAEPO method on longitudinal features outperformed all other models (Figure S11). An assessment of our methods' sensitivity to the number of longitudinal points and data missingness demonstrated the robustness and consistency of XGBoostMAEPO (Figures S12-13). Integrating prognostic models of survival and clinical intervention In those with degenerative diseases, there are subgroups that die before some clinical interventions are made. In ALS, our case study, approximately half patients are reported to never receive gastrostomies, 26 which matches our observations. This may be attributed to either the intervention being unnecessary, or premature mortality, making accurate determination of the underlying cause challenging. To better understand the latter, we ran the gold-standard ENCALS survival model 24,25 concurrently with our time-to-event models and aimed to identify factors associated with mortality preceding the intervention. Then, we postulated another set of models (Logistic Regression, Earlier Event Splitter, and Weight Splitter) to identify whether gastrostomy is likely to happen before death Figure 4A. Using a logistic regression model, we obtain directionally correct predictions of time to intervention and death, although with imperfect sensitivity. When looking at sensitivity, 44% of patients predicted to require a gastrostomy actually underwent the procedure (Figure 4B, Table S5), whereas patients censored by death had the highest proportion of death as the most likely outcome (75%). Lastly, 78% of loss of follow up patients were predicted to die before needing a gastrostomy (Figure 4Figure 4B). Comparing the models, we observe that the logistic regression is the best model with 0.63 ROC AUC and 0.61 accuracy (Figure 4C). Example prediction We hosted an example prediction (https://trajectory-timetointervention-demo.silico.science/), to visually inspect a patient’s trajectory for each longitudinal variable on the first five panels and the corresponding death and gastrostomy predictions on the sixth panel (see screenshot in Figure 5 ). Discussion Our modelling paradigm was challenging due to the highly variable disease progression and the constrained availability of clinical measures. We carried out two analyses: one of functional decline (LCGA-DTSA), and another to predict time-to-event timing. In the former analysis, we discovered three to four trajectory patterns of rapid, medium, slow, or very slow decline. From this, we found that rapid decline classes for bulbar subscore and swallow function are the two most important single predictors of time to gastrostomy insertion, more predictive than weight loss alone (Figure S7). Furthermore, we compared multiple time-to-event and feature sets, with longitudinal features and the XGBoost Regression MAEPO model performing best. We also prove that longitudinal features as defined by our LCGA-DTSA modelling framework outperform baseline features in every case and are resilient to data missingness and measurements collected at irregular time intervals. XGBoost MAE PO regression yielded lower absolute errors compared to the XGBoost Cox Survival model. However, its concordance index was lower. This discrepancy indicates that in survival analysis on data with highly variable event times, metrics and objective functions designed for survival models may be insufficient to make time to event predictions. While we provide a potentially useful measure of confidence in predicting gastrostomy before death, the proposed methodology, with a ROC AUC of 0.63, lacks sufficient reliability. Finally, we provide a hosted illustration to explore an example of potential outputs of the model. We tackled this challenging problem using three independent cohorts with large numbers compared to Oh et al. 29 , and included patients with missing values. Unlike other studies, our predictions showed a lesser skewed error distribution reducing the bias towards overestimation of probabilities (Figure S9). Comparatively, our method provides higher precision and continuous predictions across three years. 30 Our approach’s novelty hinges upon using easy-to-interpret, longitudinal features combined with pseudo-observation regression analysis, aiming at predicting time, rather than mere concordance in a very heterogeneous disease use case. Further, our functional decline classes can be calculated with as few as two time points, ranking patients by severity in a graphical and informative manner. When conducting modelling of longitudinal measures from clinical records, data sparsity and irregularity of timepoints were the main data challenges. This is mainly due to loss of follow-up before receiving the intervention and inconsistencies in protocols across centres. Gastrostomy insertion is a patient-centred decision, which may explain why some individuals did not receive a tube despite clinical indications. These and other hidden factors may contribute to uncertainty in our predictions. Our model's limitations include the need to explore alternative feature sets for time-to-gastrostomy, jointly modelling time-to-event with survival, and improving the pseudo-observation methods for computational efficiency. The combination of death and time-to-event model could benefit from integrating in a constrained optimisation framework, where the decision boundary is non-linear and decided based on clinically relevant constraints. Lastly, in future iterations we encourage researchers to use multivariate growth mixture models for a more comprehensive understanding of trajectory evolution. The generic framework of our models allows translation to other medical domains characterised by unidirectional (a.k.a. monotonic) trends preceding critical events, which includes many degenerative diseases with progressive decline, for example cardiovascular decline leading to heart failure. Declarations Ethical approval Local ethical approval was sought and granted for access to the ArQ database (STH18103). Access to PRO-ACT was approved by members of the PRO-ACT Consortium, with an ethical statement from the consortium available online. 26 Access to the IDPP dataset was given to author DW as part of the IDPP@CLEF 2022 Brainteaser challenge; further information regarding access to the IDPP dataset is available online. 27 Author Contribution V.G., J.D., and H.E.M. performed data cleaning; V.G. & J.D. performed the analysis; J.D. designed the software architecture, created the website, and visualisations with inputs from V.G., H.E.M and S.J.O; all authors contributed to conceptualising and writing the manuscript. Acknowledgement Thanks to all the investigators and physicians in the BRAINTEASER project, PRO-ACT consortium, and The University of Sheffield, who collected and gave access to these data. Most importantly, we thank all the patients and their families, who despite enduring a devastating disease, generously contributed to these studies. Data Availability The code is available here: https://github.com/jadsm/trajectory_timetointervention. Data from the IDPP dataset can be requested via https://brainteaser.dei.unipd.it /challenges/idpp2022/. Data from the PRO-ACT dataset can be requested via https://ncri1.partners.org/ProACT/Data/Index/1, see Appendix A. Restrictions apply to the availability of the ArQ dataset to maintain the patients’ rights to anonymity and prevent inappropriate use of data. The data used for this study are available upon reasonable request to the different centres involved. References Ibrahim, J. G., Chu, H. & Chen, L. M. Basic concepts and methods for joint models of longitudinal and survival data. J Clin Oncol 28 , 2796-2801 (2010). https://doi.org/10.1200/JCO.2009.25.0654 Hickey, G. L., Philipson, P., Jorgensen, A. & Kolamunnage-Dona, R. joineRML: a joint model and software package for time-to-event and multivariate longitudinal outcomes. BMC Med Res Methodol 18 , 50 (2018). https://doi.org/10.1186/s12874-018-0502-1 Campbell, K. R. et al. Comparison of a time-varying covariate model and a joint model of time-to-event outcomes in the presence of measurement error and interval censoring: application to kidney transplantation. BMC Med Res Methodol 19 , 130 (2019). https://doi.org/10.1186/s12874-019-0773-1 Elmi, A. F., Grantz, K. L. & Albert, P. S. An approximate joint model for multiple paired longitudinal outcomes and time-to-event data. Biometrics 74 , 1112-1119 (2018). https://doi.org/10.1111/biom.12862 Kim, S., Buhule, O. D. & Albert, P. S. A Joint Model Approach for Longitudinal Data with no Time-Zero and Time-to-Event with Competing Risks. Stat Biosci 11 , 449-464 (2019). https://doi.org/10.1007/s12561-019-09252-4 Li, K. & Luo, S. Functional joint model for longitudinal and time-to-event data: an application to Alzheimer's disease. Statistics in Medicine 36 , 3560-3572 (2017). https://doi.org/10.1002/sim.7381 Barrett, J., Diggle, P., Henderson, R. & Taylor-Robinson, D. Joint modelling of repeated measurements and time-to-event outcomes: flexible model specification and exact likelihood inference. J R Stat Soc Series B Stat Methodol 77 , 131-148 (2015). https://doi.org/10.1111/rssb.12060 Hartman, N., Kim, S., He, K. & Kalbfleisch, J. D. Pitfalls of the concordance index for survival outcomes. Stat Med 42 , 2179-2190 (2023). https://doi.org/10.1002/sim.9717 Niedermeyer, S., Murn, M. & Choi, P. J. Respiratory Failure in Amyotrophic Lateral Sclerosis. Chest 155 , 401-408 (2019). https://doi.org/10.1016/j.chest.2018.06.035 Renton, A. E., Chio, A. & Traynor, B. J. State of play in amyotrophic lateral sclerosis genetics. Nat Neurosci 17 , 17-23 (2014). https://doi.org/10.1038/nn.3584 ProGas Study, G. Gastrostomy in patients with amyotrophic lateral sclerosis (ProGas): a prospective cohort study. Lancet Neurol 14 , 702-709 (2015). https://doi.org/10.1016/S1474-4422(15)00104-0 Strom, T. et al. Risk factors for percutaneous endoscopic gastrostomy tube placement during chemoradiotherapy for oropharyngeal cancer. JAMA Otolaryngol Head Neck Surg 139 , 1242-1246 (2013). https://doi.org/10.1001/jamaoto.2013.5193 Castrillo-Viguera, C., Grasso, D. L., Simpson, E., Shefner, J. & Cudkowicz, M. E. Clinical significance in the change of decline in ALSFRS-R. Amyotroph Lateral Scler 11 , 178-180 (2010). https://doi.org/10.3109/17482960903093710 Zajacova, A. & Ailshire, J. Body mass trajectories and mortality among older adults: a joint growth mixture-discrete-time survival analysis. Gerontologist 54 , 221-231 (2014). https://doi.org/10.1093/geront/gns164 Dean, D. O., Bauer, D. J. & Shanahan, M. J. A discrete-time Multiple Event Process Survival Mixture (MEPSUM) model. Psychol Methods 19 , 251-264 (2014). https://doi.org/10.1037/a0034281 Nylund, K. L., Asparouhov, T. & Muthén, B. O. Deciding on the Number of Classes in Latent Class Analysis and Growth Mixture Modeling: A Monte Carlo Simulation Study. Structural Equation Modeling: A Multidisciplinary Journal 14 , 535-569 (2007). https://doi.org/10.1080/10705510701575396 Muthen, L. K. & Muthén, B. O. Mplus : statistical analysis with latent variables : user's guide . Version 4. edn, (Muthén & Muthén, 2006). Alt, H. & Godau, M. COMPUTING THE FRÉCHET DISTANCE BETWEEN TWO POLYGONAL CURVES. International Journal of Computational Geometry & Applications 05 , 75-91 (1995). https://doi.org/10.1142/S0218195995000064 Li, J. Y. et al. Correlation of weight and body composition with disease progression rate in patients with amyotrophic lateral sclerosis. Sci Rep 12 , 13292 (2022). https://doi.org/10.1038/s41598-022-16229-9 Barnwal, A. C., H; Hocking, T D. Survival regression with accelerated failure time model in XGBoost. (2020). https://doi.org/https://doi.org/10.48550/arXiv.2006.04920 Qi, S. K., N; Farrokh, M; Sun, W; Kuan, L; Ranganath, R; Henao, R; Greiner, R. in Proceedings of the 40th International Conference on Machine Learning. Janse van Mantgem, M. R. et al. Prognostic value of weight loss in patients with amyotrophic lateral sclerosis: a population-based study. J Neurol Neurosurg Psychiatry 91 , 867-875 (2020). https://doi.org/10.1136/jnnp-2020-322909 Wei, Q. et al. RNM-01 Weight stability is associated with longer survival in amyotrophic lateral sclerosis. Amyotroph Lateral Scler Frontotemporal Degener 20 , 309-326 (2019). https://doi.org/10.1080/21678421.2019.1647001 Westeneng, H. J. et al. Prognosis for patients with amyotrophic lateral sclerosis: development and validation of a personalised prediction model. Lancet Neurol 17 , 423-433 (2018). https://doi.org/10.1016/S1474-4422(18)30089-9 ENCALS Survival Tools. (ed Neurological clinical research institute). Faggioli, G. M., Stefano; Menotti, Laura; Aidos, Helena; Bergamaschi, Roberto; Birolo, Giovanni; Bosoni, Pietro; Cavalla, Paola; Chiò, Adriano; Dagliati, Arianna; de Carvalho, Mamede; Di Nunzio, Giorgio Maria; Fariselli, Piero; García Dominguez, Jose Manuel; Gromicho, Marta; Guazzo, Alessandro; Longato, Enrico; Madeira, Sara C.; Manera, Umberto; Silvello, Gianmaria,Tavazzi, Eleonora; Tavazzi, Erica; Trescato, Isotta; Vettoretti, Martina; Di Camillo, Barbara; Ferro, Nicola (2023). White, I. R., Royston, P. & Wood, A. M. Multiple imputation using chained equations: Issues and guidance for practice. Stat Med 30 , 377-399 (2011). https://doi.org/10.1002/sim.4067 Oh, H. J., Lee, W. J., Sung, J. J., Hong, Y. H. & Pooled Resource Open-Access, A. L. S. C. T. C. Individualized predictions for clinical milestone in amyotrophic lateral sclerosis: A multialgorithmic approach. Digit Health 10 , 20552076241260120 (2024). https://doi.org/10.1177/20552076241260120 Guazzo, A. et al. Predicting clinical events characterizing the progression of amyotrophic lateral sclerosis via machine learning approaches using routine visits data: a feasibility study. BMC Med Inform Decis Mak 24 , 318 (2024). https://doi.org/10.1186/s12911-024-02719-5 Additional Declarations No competing interests reported. Supplementary Files summaryresultsforpublication.xlsx Supplementarytrajectory.docx Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6717675","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Article","associatedPublications":[],"authors":[{"id":463253081,"identity":"d072ebe8-e7ad-472c-a3d8-0d0812afdf18","order_by":0,"name":"Juan A. Delgado-SanMartin","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABUklEQVRIie3Rv0rDQBwH8N8RSJZI1ytB8goJhbSg1le5oxAXKYUsQoeeBK5LqGsEwVdol64WCmbJAwgZjAQ6dQi4BC3iJVhoTN0d7jvcP/jwu98dgIzMPwxiYEFazYdnufWzSKsTtUFIjaiIoXBPSJOINAiAou83R4jClEVKPvqnd6C9vY9gaXYffZ6dj5bDlrG+zQn0TcAuqV1M9Sw6G3Tumd4xQkjsh2c07VxbideeUR8TGNgMu6sa0R1MA4XOX7dgnHwlKFQRNwSh8xgxQRQC+IrVSbegwYTOV1r2qUNyWZGeIE8x8gsCkyPEAVKsBQHHEIRWBMoqOuKiylqQ+sV81cOURWUvzpkgg1ClvB2IXnCMeI9Ykc31zWH79tRf5PluXL5YlghyESrRBhe7ZNgKtOwlvxmbLc21DolfluLQDNn/2u+PNKtx9zeRkZGRkYFv4xF4tIQ6cj8AAAAASUVORK5CYII=","orcid":"","institution":"National Heart and Lung Institute, Imperial College London","correspondingAuthor":true,"prefix":"","firstName":"Juan","middleName":"A.","lastName":"Delgado-SanMartin","suffix":""},{"id":463253082,"identity":"e0a10a06-021b-44e6-b94d-ac2c137eaf55","order_by":1,"name":"Varsha Gupta","email":"","orcid":"","institution":"Agency for Science, Technology and Research","correspondingAuthor":false,"prefix":"","firstName":"Varsha","middleName":"","lastName":"Gupta","suffix":""},{"id":463253083,"identity":"4979b5ec-9515-48ee-a1da-5c6593ece553","order_by":2,"name":"Harry E. McDonough","email":"","orcid":"","institution":"Sheffield Teaching Hospitals","correspondingAuthor":false,"prefix":"","firstName":"Harry","middleName":"E.","lastName":"McDonough","suffix":""},{"id":463253084,"identity":"1b5bfaa4-c3e4-4f9c-aa0a-f3cbe4caa2e9","order_by":3,"name":"Siying Jane Ong","email":"","orcid":"","institution":"Agency for Science, Technology and Research","correspondingAuthor":false,"prefix":"","firstName":"Siying","middleName":"Jane","lastName":"Ong","suffix":""},{"id":463253085,"identity":"a97b3905-c2be-425b-bafe-4801a3fcf866","order_by":4,"name":"Christopher J. McDermott","email":"","orcid":"","institution":"University of Sheffield","correspondingAuthor":false,"prefix":"","firstName":"Christopher","middleName":"J.","lastName":"McDermott","suffix":""},{"id":463253086,"identity":"eac30b9d-d335-488a-abed-e6b35615e910","order_by":5,"name":"Dennis Wang","email":"","orcid":"","institution":"National Heart and Lung Institute, Imperial College London","correspondingAuthor":false,"prefix":"","firstName":"Dennis","middleName":"","lastName":"Wang","suffix":""}],"badges":[],"createdAt":"2025-05-21 14:53:30","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6717675/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6717675/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":83812227,"identity":"cbc7f295-8c21-42ba-a4d4-43fae979d340","added_by":"auto","created_at":"2025-06-03 07:10:01","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":306055,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cem\u003eOverview of modelling framework. A) Baseline and longitudinal clinical measures were derived to predict time to gastrostomy insertion. The data from three cohorts were divided into training/validation and testing sets for nested cross-validation. B) Methodological steps: feature extraction from baseline and longitudinal measures, benchmarking of time-to-event models, integration with overall survival model, and finally an interactive web-app for evaluating new patients\u003c/em\u003e\u003c/p\u003e","description":"","filename":"1.png","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/6ba79885931ba085b606e03b.png"},{"id":83812229,"identity":"c6f64146-627c-40d3-83f8-41e7bf2bc47a","added_by":"auto","created_at":"2025-06-03 07:10:01","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":253009,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cem\u003eUnsupervised classification of patient trajectories based on joint latent class growth analysis and discrete-time survival analysis. Patients are grouped into three or four different classes of decline based on their (A) ALSFRS-R total scores, (B) bulbar subscores, (C) swallowing function or Q3, (D) respiratory function. The probability of gastrostomy for each set of classes is estimated for each class at each timepoint up to 3 years (1080 days) following onset of disease.\u003c/em\u003e\u003c/p\u003e","description":"","filename":"2.png","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/fd8eab4aeb260279fde3dba9.png"},{"id":83812225,"identity":"4db0d843-4780-42cb-a16b-d3b940dd6fa6","added_by":"auto","created_at":"2025-06-03 07:10:01","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":226194,"visible":true,"origin":"","legend":"\u003cp\u003ePerformance of time to gastrostomy prediction across different models and feature set combinations (baseline and longitudinal). A) Predictive performance of single features. Coral line on the left represents the longitudinal features. B) Predicted time of gastrostomy is compared to the observed time in computing the Concordance Index (Cindex) and Median Absolute Error (MedianAE). The feature set ‘weight’ refers to a naïve model where 10% weight loss from baseline would be used as criterion to insert gastrostomy. C) Distribution of Median Absolute Error by month over the first 3 years for the XGBoost MAEPO model.\u003c/p\u003e","description":"","filename":"3.png","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/e719a0e509dfbd52da2a6b82.png"},{"id":83813098,"identity":"09a76ff9-dde1-4b13-ab1c-f88bc614ee93","added_by":"auto","created_at":"2025-06-03 07:18:01","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":134631,"visible":true,"origin":"","legend":"\u003cp\u003eIntegration of models of overall survival and gastrostomy. A) Predicted time to gastrostomy and time to death from our gastrostomy model (XGBoost MAEPO) and the ENCALS survival model are combined in a classifier to provide a binary outcome prediction for whether a patient should receive a gastrostomy. B) Confusion matrix of patients predicted to have a higher probability of death, or gastrostomy based on the classifier with respect to the observed outcomes of patients in the ArQ cohort. C) Receiver-Operator curves for the classifier performance when the gastrostomy and survival time predictions are combined using a logistic regression model, or when predicted gastrostomy occurs before the predicted death (earlier event), or when there was a 10% weight loss (weight).\u003c/p\u003e","description":"","filename":"4.png","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/3c0f34e6bf3294984649ae72.png"},{"id":83813096,"identity":"ed988419-4e82-4561-9ed9-82b2e03777e0","added_by":"auto","created_at":"2025-06-03 07:18:01","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":122688,"visible":true,"origin":"","legend":"\u003cp\u003e\u003cem\u003eExample prediction visualisation. Panel 1-5 show the functional decline trajectories for each class and the individual values for the sample patient. Panel 6 shows the probability curves of gastrostomy and overall survival.\u003c/em\u003e\u003c/p\u003e","description":"","filename":"5.png","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/dac120f85db30f890c035cc5.png"},{"id":83814935,"identity":"cffcdb57-b3cb-4f9c-bc12-18ed08093472","added_by":"auto","created_at":"2025-06-03 07:34:04","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1622396,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/f00446fc-49ed-4c15-aba9-690208a0b29b.pdf"},{"id":83813097,"identity":"c0fea732-e491-4813-a380-8816e29b8999","added_by":"auto","created_at":"2025-06-03 07:18:01","extension":"xlsx","order_by":0,"title":"","display":"","copyAsset":false,"role":"supplement","size":23209,"visible":true,"origin":"","legend":"","description":"","filename":"summaryresultsforpublication.xlsx","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/04d6f90dbb5c497499eef587.xlsx"},{"id":83812234,"identity":"d724958a-e7b8-4016-a46c-db0f7ce10050","added_by":"auto","created_at":"2025-06-03 07:10:02","extension":"docx","order_by":1,"title":"","display":"","copyAsset":false,"role":"supplement","size":22983956,"visible":true,"origin":"","legend":"","description":"","filename":"Supplementarytrajectory.docx","url":"https://assets-eu.researchsquare.com/files/rs-6717675/v1/a5d959fdbd297df365ea60c1.docx"}],"financialInterests":"No competing interests reported.","formattedTitle":"Machine Learning Framework for Longitudinal Functional Decline and Time-to-Event Prediction","fulltext":[{"header":"Introduction","content":"\u003cp\u003eClinical data exhibits inherent messiness characterised by missingness, inconsistencies, and heterogeneity. Integrating longitudinal and baseline features is particularly challenging\u003csup\u003e\u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e1\u003c/span\u003e\u003c/sup\u003e especially when variables are sourced from aggregated datasets across disparate hospitals and localities. Survival models face limitations in accurately predicting the exact time of an event, particularly when data is heavily censored.\u003csup\u003e\u003cspan additionalcitationids=\"CR3 CR4 CR5 CR6\" citationid=\"CR2\" class=\"CitationRef\"\u003e2\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e7\u003c/span\u003e\u003c/sup\u003e Further, when events are sparsely distributed over time, the model's ability to learn precise time predictions is particularly diminished when using conventional survival modelling.\u003csup\u003e\u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e8\u003c/span\u003e\u003c/sup\u003e Its limited success is partially due ignoring longitudinal measures of health decline.\u003c/p\u003e \u003cp\u003eOver the course of many degenerative diseases, patients may need supportive clinical interventions. Being able to predict when patients need these interventions would help in care planning. One such disease with this need is amyotrophic lateral sclerosis (ALS), a fatal neurodegenerative disorder affecting motor neurons that results in progressive muscle weakness, with death most commonly secondary to respiratory failure.\u003csup\u003e\u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e9\u003c/span\u003e\u003c/sup\u003e The progression of ALS is, however, considerably heterogeneous, impacted by phenotypic and genetic factors.\u003csup\u003e\u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e10\u003c/span\u003e\u003c/sup\u003e This variability makes it challenging for clinicians to predict when patients may need clinical interventions, such as a gastrostomy. Early insertion of a gastrostomy tube to avoid continued weight loss is known to be prognostically important, both in ALS\u003csup\u003e\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e\u003c/sup\u003e and other conditions, such as head and neck cancers.\u003csup\u003e\u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e12\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003cp\u003eIn this study, we look to tackle the challenges of utilising clinical data in time-to-event prediction, describing a framework for modelling the longitudinal changes in clinical biomarkers and using these to predict the time to clinical intervention using trajectories of functional decline (Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003eA). We compare the longitudinal trajectories as features and compare them to baseline clinical measures (Fig.\u0026nbsp;\u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003eB).\u003c/p\u003e \u003cp\u003e \u003c/p\u003e"},{"header":"Methods","content":"\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e \u003ch2\u003eData preprocessing\u003c/h2\u003e \u003cp\u003eData were separated into static and longitudinal variables, with duplicate values removed. Descriptors of clinical factors were standardised across data sources to align terminology. Data on longitudinal variables with repeated measures were anchored to a standardised timescale, with day 0 defined as the day of symptom onset. Thereafter, data were aligned into 30-day intervals, with up to three years of follow-up data utilised. Finally, the ALSFRS-R slope, a known predictor of the rate of ALS progression, was computed, as described previously.\u003csup\u003e\u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e13\u003c/span\u003e\u003c/sup\u003e Data were not otherwise transformed or reduced in dimensionality.\u003c/p\u003e \u003c/div\u003e\n\u003ch3\u003eModelling trajectories of functional decline\u003c/h3\u003e\n\u003cp\u003eFor classification of trajectories using joint latent class growth analysis-discrete time survival analysis model (LCGA-DTSA),\u003csup\u003e\u003cspan additionalcitationids=\"CR15\" citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e\u003c/sup\u003e we used the four longitudinal functional decline markers from the patients who had at least three timepoints from time of onset. We assumed maximum values of these markers at the time of onset of 48 for ALSFRS-R total score, 12 for bulbar subscore, 4 for swallow function (Q3) and 100% for respiratory function/VC, which gave us four timepoints.\u003c/p\u003e \u003cp\u003eWe then estimated the discrete factor \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\prime\\:}f{\\prime\\:}\\)\u003c/span\u003e\u003c/span\u003e. For that, the three-year study follow-up period was divided into twelve equal intervals of 90 days, labelled \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{u}_{1}\\:to\\:{u}_{12}\\)\u003c/span\u003e\u003c/span\u003e, where each \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{u}_{i}\\)\u003c/span\u003e\u003c/span\u003e is binary and represents gastrostomy insertion. Missing values correspond to censoring information, i.e. death or loss of follow up. We then constructed a factor \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\prime\\:}f{\\prime\\:}\\)\u003c/span\u003e\u003c/span\u003e from these discretised times (\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{u}_{i}\\)\u003c/span\u003e\u003c/span\u003e) (Table S3).\u003csup\u003e\u003cspan citationid=\"CR17\" class=\"CitationRef\"\u003e17\u003c/span\u003e\u003c/sup\u003e To address data sparsity, we performed a quadratic polynomial fit for each discretised 90 day interval until time to event (Figure S3).\u003c/p\u003e \u003cp\u003eThe estimated trajectories from quadratic polynomials and the discrete factor \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\u0026lsquo;f\u0026rsquo;\\)\u003c/span\u003e\u003c/span\u003e were used to perform joint latent class growth analysis\u0026ndash;discrete time survival analysis model LCGA-DTSA\u003csup\u003e\u003cspan additionalcitationids=\"CR15\" citationid=\"CR14\" class=\"CitationRef\"\u003e14\u003c/span\u003e\u0026ndash;\u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e16\u003c/span\u003e\u003c/sup\u003e in MPLUS (Figure S3). The joint modelling approach enabled identification of distinct patient functional decline trajectory groups mapping to ranked survival trajectory groups. The decision on the number of classes was made based on Bayesian Information Criterion, entropy of classification, posterior probability of belonging to a class and the overlap of 95% confidence intervals of trajectories and the survival curves (generated in Matlab using \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\u0026lsquo;ecdf\u0026rsquo;\\)\u003c/span\u003e\u003c/span\u003e for \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\u0026lsquo;survivor\u0026rsquo;\\)\u003c/span\u003e\u003c/span\u003e functions).\u003c/p\u003e\n\u003ch3\u003eFeature sets for time-to-gastrostomy modelling\u003c/h3\u003e\n\u003cp\u003eWe juxtapose two feature sets: the Baseline set was composed of 8 features (sex, age at onset, site of onset, presence of \u003cem\u003eC9orf72, El Escorial\u003c/em\u003e, ALS Phenotype, respiratory function in terms of vital capacity (VC), and diagnostic delay) and the Longitudinal set was composed of 4\u0026thinsp;+\u0026thinsp;3\u0026thinsp;=\u0026thinsp;7 features (4 functional decline classes extracted via joint LCGA\u003cem\u003e-DTSA\u003c/em\u003e, and 3 additional: 5% Weight loss class, ALSFRS-R initial slope, and Bulbar initial slope).\u003c/p\u003e\n\u003ch3\u003eMapping new patients to classes via Fréchet distances\u003c/h3\u003e\n\u003cp\u003eWe used the functional decline classes defined through LCGA-DTSA as another feature set. Because of the non-parametric nature of LCGA-DTSA, the classes of new patients are mapped using Fr\u0026eacute;chet distances,\u003csup\u003e\u003cb\u003e\u003cspan citationid=\"CR18\" class=\"CitationRef\"\u003e18\u003c/span\u003e\u003c/b\u003e\u003c/sup\u003e taking the minimum Fr\u0026eacute;chet distance for each collection of points belonging to one patient as the chosen class. Formally, let us define the collection of input points as \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:P\\)\u003c/span\u003e\u003c/span\u003e and the closest point to the exponential decay function of each class \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:c\\)\u003c/span\u003e\u003c/span\u003e evaluated at each \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:t\\)\u003c/span\u003e\u003c/span\u003e contained in \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:P\\)\u003c/span\u003e\u003c/span\u003e. We can then calculate a Fr\u0026eacute;chet distance for each class \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:c\\)\u003c/span\u003e\u003c/span\u003e, with a relative weight based on the absolute value of the Fr\u0026eacute;chet distance, see Figure S4. We map the data with insufficient points as illustrated in Figure \u003cspan refid=\"MOESM1\" class=\"InternalRef\"\u003eS1\u003c/span\u003e (n\u0026thinsp;=\u0026thinsp;2,675) using this method.\u003c/p\u003e\n\u003ch3\u003eEstimating weight loss trajectory classes\u003c/h3\u003e\n\u003cp\u003eAlongside the functional decline classes, we defined a weight loss class corresponding to 5% weight loss from baseline, which corresponds to lower fat mass associated to faster disease progression.\u003csup\u003e\u003cspan citationid=\"CR19\" class=\"CitationRef\"\u003e19\u003c/span\u003e\u003c/sup\u003e We observed in this cohort that weight does not deteriorate continuously from onset, rather it remains constant after the disease onset and, only after a time lag, starts to deteriorate. In the training dataset retrospectively, we defined two factors to define this: (i) a binary parameter to mark 5% weight loss in patients: 1 if patient lost\u0026thinsp;\u0026ge;\u0026thinsp;5%, 0 otherwise,\u003csup\u003e\u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e11\u003c/span\u003e\u003c/sup\u003e (ii) time from onset at which this loss happens, see Figure S5 for individual trajectories and Figure S6 for the groups trajectories.\u003c/p\u003e \u003cdiv id=\"Sec8\" class=\"Section2\"\u003e \u003ch2\u003eBaseline features\u003c/h2\u003e \u003cp\u003eWe compare the longitudinal results with static features normally collected around the time to diagnosis. These features are sex, site of onset (spinal vs bulbar), age at onset, diagnostic delay (time from symptom onset to diagnosis), forced vital capacity (FVC; percentage of predicted based on normative values for age, sex, and body height), El Escorial, and presence of a \u003cem\u003eC9orf72\u003c/em\u003e mutation.\u003c/p\u003e \u003c/div\u003e\n\u003ch3\u003eLongitudinal features\u003c/h3\u003e\n\u003cp\u003eWe grouped together all longitudinal features: functional decline classes, weight loss classes, progression rate defined by the slope on the revised ALS Functional Rating Scale (ALSFRS-R), and the slope on bulbar function. For the functional decline and weight loss classes, after inferring the class belonging, we sampled every 90 days from a normal distribution with mean defined as the exponential decline fit of each class and with the standard deviation from the training set. This produces 13 feature columns per class providing a projection of functional decline.\u003c/p\u003e\n\u003ch3\u003ePrediction models for time-to-event\u003c/h3\u003e\n\u003cp\u003eTo build our time prediction framework for time-to-event (gastrostomy insertion), we considered the following survival and regression models: COX Linear (proportional hazards), COX XGBoost survival model (see eqs. SA1-2 in Appendix A),\u003csup\u003e\u003cspan citationid=\"CR20\" class=\"CitationRef\"\u003e20\u003c/span\u003e\u003c/sup\u003e and XGBoost regression with pseudo-observations,\u003csup\u003e\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e\u003c/sup\u003e described as a regression model where the variable to be predicted is time to gastrostomy. We also compare the results to a na\u0026iuml;ve 10% weight loss model, which has been linked to 23% increase in mortality rate.\u003csup\u003e\u003cspan citationid=\"CR22\" class=\"CitationRef\"\u003e22\u003c/span\u003e,\u003cspan citationid=\"CR23\" class=\"CitationRef\"\u003e23\u003c/span\u003e\u003c/sup\u003e Because most of our data (75%) is censored, i.e. gastrostomy did not happen before death or loss of follow-up, we calculated pseudo-observations for all censored data using the method defined in Qi et al. (NB: we adapted their original equation).\u003csup\u003e\u003cspan citationid=\"CR21\" class=\"CitationRef\"\u003e21\u003c/span\u003e\u003c/sup\u003e Let us define the time of pseudo-observation as:\u003cdiv id=\"Equ1\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equ1\" name=\"EquationSource\"\u003e\n$$\\:{t}_{PO,i}=\\left(1-{\\delta\\:}_{i}\\right)\\cdot\\:{e}_{margin}\\left({t}_{i}\\right)+{t}_{i}$$\u003c/div\u003e\u003cdiv class=\"EquationNumber\"\u003e1\u003c/div\u003e\u003c/div\u003e,\u003c/p\u003e \u003cp\u003ewhere the \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\delta\\:}_{i}\\)\u003c/span\u003e\u003c/span\u003e is a Dirac delta representing the event, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{e}_{margin}\\left({t}_{i}\\right)\\)\u003c/span\u003e\u003c/span\u003e an error margin based on the censored data, and \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{t}_{i}\\)\u003c/span\u003e\u003c/span\u003e the time of censored patient. Now we define the error margin as\u003cdiv id=\"Equ2\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equ2\" name=\"EquationSource\"\u003e\n$$\\:{e}_{margin}\\left({t}_{i},\\mathcal{D}\\right)=N\\cdot\\:\\widehat{\\theta\\:}-\\left(N-1\\right)\\cdot\\:{\\widehat{\\theta\\:}}^{-i}$$\u003c/div\u003e\u003cdiv class=\"EquationNumber\"\u003e2\u003c/div\u003e\u003c/div\u003e,\u003c/p\u003e \u003cp\u003eWhere \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:N\\)\u003c/span\u003e\u003c/span\u003e is the number of patients, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\widehat{\\theta\\:}\\)\u003c/span\u003e\u003c/span\u003e is an unbiased estimator of the entire population survival (\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\mathcal{D}\\)\u003c/span\u003e\u003c/span\u003e) and \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\widehat{\\theta\\:}}^{-i}\\)\u003c/span\u003e\u003c/span\u003e is missing the observation \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:i\\)\u003c/span\u003e\u003c/span\u003e.\u003c/p\u003e \u003cp\u003eOnce defined the pseudo-observations, we used weighted least squares approximation:\u003cdiv id=\"Equ3\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equ3\" name=\"EquationSource\"\u003e\n$$\\:{\\Phi\\:}=\\sum\\:2\\cdot\\:{w}_{i}\\cdot\\:({t}_{PO,i}\\:-\\:{\\widehat{t}}_{i})$$\u003c/div\u003e\u003cdiv class=\"EquationNumber\"\u003e3\u003c/div\u003e\u003c/div\u003e,\u003c/p\u003e \u003cp\u003ewhere \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\Phi\\:}\\)\u003c/span\u003e\u003c/span\u003e is the objective function, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{\\widehat{t}}_{i}\\)\u003c/span\u003e\u003c/span\u003e is the predicted times by the model, weights are defined as \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:{w}_{i}={t}_{i}^{S}\\)\u003c/span\u003e\u003c/span\u003e, S being a sigmodal, \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:S=\\frac{2}{1+exp\\left(\\frac{y-\\beta\\:}{\\alpha\\:}\\right)}\\)\u003c/span\u003e\u003c/span\u003e to penalise overestimations at earlier timepoints. Note that we chose these values after a few tests revealing that the best values were \u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:\\alpha\\:=365\\cdot\\:3,\\:\\beta\\:=365\\)\u003c/span\u003e\u003c/span\u003e. These values can be estimated in other ways too.\u003c/p\u003e \u003cp\u003eFollowing the objective function definition Eq.\u0026nbsp;(\u003cspan refid=\"Equ3\" class=\"InternalRef\"\u003e3\u003c/span\u003e), we chose mean absolute error (MAE) as the intrinsic validation metric, defined as:\u003cdiv id=\"Equ4\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equ4\" name=\"EquationSource\"\u003e\n$$\\:MA{E}_{PO}=\\frac{1}{N}\\sum\\:\\left|{t}_{PO,i}-{\\widehat{t}}_{i}\\right|$$\u003c/div\u003e\u003cdiv class=\"EquationNumber\"\u003e4\u003c/div\u003e\u003c/div\u003e.\u003c/p\u003e \u003cdiv id=\"Sec11\" class=\"Section2\"\u003e \u003ch2\u003eDefining labels to integrate time-to-event and survival model predictions\u003c/h2\u003e \u003cp\u003eSince patients may die before needing the intervention (event), we characterised the risk of death using a previously published survival model for ALS.\u003csup\u003e\u003cspan citationid=\"CR24\" class=\"CitationRef\"\u003e24\u003c/span\u003e,\u003cspan citationid=\"CR25\" class=\"CitationRef\"\u003e25\u003c/span\u003e\u003c/sup\u003e We assign a confidence level by running the gastrostomy and overall survival models on the same patients and comparing both predicted times. For that, we trained a logistic regression and compared it to two na\u0026iuml;ve models: a simple diagonal splitter which divides the data into: death is predicted to happen before gastrostomy or gastrostomy happens before death; and a model where the data is divided into patients who experienced 10% weight loss and those who did not.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec12\" class=\"Section2\"\u003e \u003ch2\u003eModel training and evaluation\u003c/h2\u003e \u003cp\u003eWe performed a nested cross validation for Bayesian hyperparameter optimisation using Optuna. The external cross validation had three folds (k\u0026thinsp;=\u0026thinsp;3) (one per database) and the internal had k\u0026thinsp;=\u0026thinsp;5 folds stratified by database and split randomly from the training set into training and validation set at a ratio of 70/30. We allowed for five hyperparameter trials starting from random positions. In total we computed 75 optimisations.\u003c/p\u003e \u003cp\u003eThe evaluation metrics used are Uno\u0026rsquo;s Concordance Index and Median Absolute Error (\u003cspan class=\"InlineEquation\"\u003e\u003cspan class=\"mathinline\"\u003e\\(\\:MedianAE\\)\u003c/span\u003e\u003c/span\u003e) on the uncensored data.\u003c/p\u003e \u003cp\u003eNote that all metrics are evaluated on true observations and not pseudo-observations. We performed Permutation Feature Importance and a series of sensitivity analyses which included effect of data missingness at random and model resilience to missingness of longitudinal measurements. The 95% confidence intervals for each variable have been estimated using Bootstrapping on 100 simulations of 80% samples on the external validation set.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec13\" class=\"Section2\"\u003e \u003ch2\u003eSoftware \u0026amp; Hardware\u003c/h2\u003e \u003cp\u003eData engineering was done in pandas (python 3.11), LCGA-DTSA analysis done in MPLUS v8.8 and Matlab v2023b, time to gastrostomy prediction \u0026amp; the backend of the web app in python 3.11.6 using pandas, scikit-learn, XGBoost, Altair. The frontend was done in HTML/JS and deployed as a monolithic application to Google Cloud\u0026rsquo;s AppEngine. Hardware used was 96Gb RAM MacOS15 on M3 MacBookMax 2024.\u003c/p\u003e \u003c/div\u003e\u003cp\u003e\u003cstrong\u003e\u003cem\u003eEthical approval\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eLocal ethical approval was sought and granted for access to the ArQ database (STH18103). Access to PRO-ACT was approved by members of the PRO-ACT Consortium, with an ethical statement from the consortium available online.\u003csup\u003e26\u003c/sup\u003e\u0026nbsp;Access to the IDPP dataset was given to author DW as part of the IDPP@CLEF 2022 Brainteaser challenge; further information regarding access to the IDPP dataset is available online.\u003csup\u003e27\u003c/sup\u003e\u003c/p\u003e"},{"header":"Results","content":"\u003cp\u003e\u003cstrong\u003e\u003cem\u003eClassification of functional decline for patient stratification\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe joint latent class growth analysis\u0026ndash;discrete time survival analysis model revealed four functional decline classes in cases of ALSFRS-R, bulbar subscore and three classes in case of swallowing function (Q3) and respiratory function, see\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eFigure\u003cem\u003e\u0026nbsp;2\u003c/em\u003e. In all cases, the optimum number of classes corresponded to Entropy\u0026ge;0.898, non-overlapping 95% confidence interval of both for trajectories and the survival curves of gastrostomy, and the mean posterior probability of belonging to the respective classes was \u0026ge;0.953 (supplementary Table S4).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eFigure\u003cem\u003e\u0026nbsp;2\u003c/em\u003e shows classes of trajectories for each variable and the corresponding gastrostomy probabilities.\u003c/p\u003e\n\u003cp\u003eUsing unsupervised LCGA-DSTA model, four trajectory classes were identified in ALSFRS-R total score, namely, very slow (n=2,392), slow (n=2,266), medium (n=956) and fast (n=93). It can be observed that the mean score increases towards the end of trajectories. This is because those with lower scores die sooner, leaving patients who live longer and, thus, have higher functional scores. Similarly, four trajectory patterns in the bulbar subscore corresponded to slow (n=3,302), slow-medium (n=176), whereby a small number of patients had slow decline till day ~400 and then declined with a similar slope to the medium trajectory (n=1,410). The fast decline trajectory in the bulbar subscore had 567 patients and highest probability of gastrostomy. The three trajectory patterns observed in swallowing function (Q3) were slow (n=3,439), medium (n=1,473) and fast (n=543). Similarly, respiratory function patterns corresponded to slow (n=774), medium (n=1,560) and fast (n=618). In the case of weight loss, the classes were derived by defining a 5% loss from baseline with two classes: loss (n=2,267, fast) or no-loss (n=4,044, medium) see Figure S6.\u003c/p\u003e\n\u003cp\u003eThe most rapid decline classes (marked as \u0026lsquo;fast\u0026rsquo;) showed that swallow function and bulbar score declines are the most crucial with means of 16-18 months to reach 0.5 probability of gastrostomy (see Figure S7).\u003c/p\u003e\n\u003cp\u003eMapping the remaining patients (those with fewer than four longitudinal points) using Fr\u0026eacute;chet distances revealed higher mapping accuracies (75%) for features with three classes compared to those with four classes (60%), see Figure S8.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cem\u003ePredicting time-to-event\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eWe investigated three main models: XGBoost with MAEPO regression, XGBoost with Cox Survival and Linear Cox survival model, and compared them to a weight-only na\u0026iuml;ve classifier. The na\u0026iuml;ve classifier assumes 10% weight loss from baseline is the criterion for gastrostomy insertion. In Figure 3A, we show the results of our best performing model (XGBoost with MAEPO regression) trained on individual features, showing that the bulbar and ALSFRS-R decline slopes alongside the Q3 and bulbar functional decline classes have the most predictive potential. We then compared all three models and the weight na\u0026iuml;ve model using two feature sets: longitudinal and the baseline. The performance metrics show that the longitudinal set outperforms in every case the baseline set. Noticeably, although the best performing model is our proposed XGBoost MAEPO model, the XGBoost Cox Survival model shows superior results in Concordance index in some cases (Figure 3B). The worst model was the linear Cox Proportional Hazards model. In any case, all models comfortably outperform the weight na\u0026iuml;ve classifier, which represents the decision criterion clinicians often use for gastrostomy need assessment. In terms of the databases, all test rotations showed acceptable results. The best classifier (XGBoost MAEPO + longitudinal features, testing on ArQ) achieved concordance indices of 0.739 (IQR, 0.724-0.754) and median absolute error of 193 (186-200) days. In comparison, the best survival classifier (XGBoost Cox + longitudinal features, testing on ArQ) achieved median concordance indices of 0.766 (0.753-0.778) but median absolute error of 295 (IQR, 278-311) days. Although the XGBoost Cox model demonstrated a slight improvement of 0.027 points in concordance index relative to the XGBoost MAEPO model, this was offset by the 102-day increase in median absolute error, ultimately resulting in a weaker overall predictive capability. Lastly, absolute error over time shows stability for longitudinal features after four months, while baseline features exhibit higher error that gradually decreases throughout the three-year period (Figure 3C), also corroborated by the individual prediction bias plot (Figure S9). Numeric results of all estimations are captured in the Supplementary Materials.\u003c/p\u003e\n\u003cp\u003eA test using Multiple Imputation by Chained Reactions (MICE) was carried out to understand its potential use. Results show a modest increase in performance, particularly in the baseline set (Figure S10).\u003csup\u003e28\u003c/sup\u003e Due to the associated risks of introducing artificial bias, imputation was discouraged in this study.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eAn evaluation of prediction performance across varying tolerance levels revealed that our XGBoostMAEPO method on longitudinal features outperformed all other models (Figure S11). An assessment of our methods\u0026apos; sensitivity to the number of longitudinal points and data missingness demonstrated the robustness and consistency of XGBoostMAEPO (Figures S12-13).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cem\u003eIntegrating prognostic models of survival and clinical intervention\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eIn those with degenerative diseases, there are subgroups that die before some clinical interventions are made.\u0026nbsp;In\u0026nbsp;ALS, our case study, approximately half patients are reported to never receive gastrostomies,\u003csup\u003e26\u003c/sup\u003e which matches our observations. This may be attributed to either the intervention being unnecessary, or premature mortality, making accurate determination of the underlying cause challenging. To better understand the latter, we ran the gold-standard ENCALS survival model\u003csup\u003e24,25\u003c/sup\u003e concurrently with our time-to-event models and aimed to identify factors associated with mortality preceding the intervention. Then, we postulated another set of models (Logistic Regression, Earlier Event Splitter, and Weight Splitter) to identify whether gastrostomy is likely to happen before death Figure 4A. Using a logistic regression model, we obtain directionally correct predictions of time to intervention and death, although with imperfect sensitivity. When looking at sensitivity, 44% of patients predicted to require a gastrostomy actually underwent the procedure (Figure 4B, Table S5), whereas patients censored by death had the highest proportion of death as the most likely outcome (75%). Lastly, 78% of loss of follow up patients were predicted to die before needing a gastrostomy (Figure 4Figure 4B). Comparing the models, we observe that the logistic regression is the best model with 0.63 ROC AUC and 0.61 accuracy (Figure 4C).\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e\u003cem\u003eExample prediction\u003c/em\u003e\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eWe hosted an example prediction (https://trajectory-timetointervention-demo.silico.science/), to visually inspect a patient\u0026rsquo;s trajectory for each longitudinal variable on the first five panels and the corresponding death and gastrostomy predictions on the sixth panel (see screenshot in\u0026nbsp;Figure\u003cem\u003e\u0026nbsp;5\u003c/em\u003e).\u003c/p\u003e"},{"header":"Discussion","content":"\u003cp\u003eOur modelling paradigm was challenging due to the highly variable disease progression and the constrained availability of clinical measures. We carried out two analyses: one of functional decline (LCGA-DTSA), and another to predict time-to-event timing. In the former analysis, we discovered three to four trajectory patterns of rapid, medium, slow, or very slow decline. From this, we found that rapid decline classes for bulbar subscore and swallow function are the two most important single predictors of time to gastrostomy insertion, more predictive than weight loss alone (Figure S7). Furthermore, we compared multiple time-to-event and feature sets, with longitudinal features and the XGBoost Regression MAEPO model performing best. We also prove that longitudinal features as defined by our LCGA-DTSA modelling framework outperform baseline features in every case and are resilient to data missingness and measurements collected at irregular time intervals.\u0026nbsp;XGBoost MAE PO regression yielded lower absolute errors compared to the XGBoost Cox Survival model. However, its concordance index was lower. This discrepancy indicates that in survival analysis on data with highly variable event times, metrics and objective functions designed for survival models may be insufficient to make time to event predictions. While we provide a potentially useful measure of confidence in predicting gastrostomy before death, the proposed methodology, with a ROC AUC of 0.63, lacks sufficient reliability. Finally, we provide a hosted illustration to explore an example of potential outputs of the model.\u003c/p\u003e\n\u003cp\u003eWe tackled this challenging problem using three independent cohorts with large numbers compared to\u0026nbsp;Oh et al.\u003csup\u003e29\u003c/sup\u003e, and included patients with missing values. Unlike other studies, our predictions showed a lesser skewed error\u0026nbsp;distribution\u0026nbsp;reducing the\u0026nbsp;bias towards overestimation\u0026nbsp;of\u0026nbsp;probabilities (Figure S9).\u0026nbsp;Comparatively, our method provides higher precision and continuous predictions across three years.\u0026nbsp;\u003csup\u003e30\u003c/sup\u003e Our approach’s novelty hinges upon using easy-to-interpret, longitudinal features combined with pseudo-observation regression analysis, aiming at predicting time, rather than mere concordance in a very heterogeneous disease use case. Further, our functional decline classes can be calculated with as few as two time points, ranking patients by severity in a graphical and informative manner.\u003c/p\u003e\n\u003cp\u003eWhen conducting modelling of longitudinal measures from clinical records, data sparsity and irregularity of timepoints were the main data challenges. This is mainly due to loss of follow-up before receiving the intervention and inconsistencies in protocols across centres. Gastrostomy insertion is a patient-centred decision, which may explain why some individuals did not receive a tube despite clinical indications. These and other hidden factors may contribute to uncertainty in our predictions. Our model's limitations include the need to explore alternative feature sets for time-to-gastrostomy, jointly modelling time-to-event with survival, and improving the pseudo-observation methods for computational efficiency. The combination of death and time-to-event model could benefit from integrating in a constrained optimisation framework, where the decision boundary is non-linear and decided based on clinically relevant constraints. Lastly, in future iterations we encourage researchers to use multivariate growth mixture models for a more comprehensive understanding of trajectory evolution.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eThe generic framework of our models allows translation to other medical domains characterised by unidirectional (a.k.a. monotonic) trends preceding critical events, which includes many degenerative diseases with progressive decline, for example cardiovascular decline leading to heart failure.\u0026nbsp;\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e \u003ch2\u003eEthical approval\u003c/h2\u003e \u003cp\u003eLocal ethical approval was sought and granted for access to the ArQ database (STH18103). Access to PRO-ACT was approved by members of the PRO-ACT Consortium, with an ethical statement from the consortium available online.\u003csup\u003e\u003cspan citationid=\"CR26\" class=\"CitationRef\"\u003e26\u003c/span\u003e\u003c/sup\u003e Access to the IDPP dataset was given to author DW as part of the IDPP@CLEF 2022 Brainteaser challenge; further information regarding access to the IDPP dataset is available online.\u003csup\u003e\u003cspan citationid=\"CR27\" class=\"CitationRef\"\u003e27\u003c/span\u003e\u003c/sup\u003e\u003c/p\u003e \u003c/p\u003e\u003ch2\u003eAuthor Contribution\u003c/h2\u003e\u003cp\u003eV.G., J.D., and H.E.M. performed data cleaning; V.G. \u0026amp; J.D. performed the analysis; J.D. designed the software architecture, created the website, and visualisations with inputs from V.G., H.E.M and S.J.O; all authors contributed to conceptualising and writing the manuscript.\u003c/p\u003e\u003ch2\u003eAcknowledgement\u003c/h2\u003e\u003cp\u003eThanks to all the investigators and physicians in the BRAINTEASER project, PRO-ACT consortium, and The University of Sheffield, who collected and gave access to these data. Most importantly, we thank all the patients and their families, who despite enduring a devastating disease, generously contributed to these studies.\u003c/p\u003e\u003ch2\u003eData Availability\u003c/h2\u003e\u003cp\u003eThe code is available here: https://github.com/jadsm/trajectory_timetointervention. Data from the IDPP dataset can be requested via https://brainteaser.dei.unipd.it /challenges/idpp2022/. Data from the PRO-ACT dataset can be requested via https://ncri1.partners.org/ProACT/Data/Index/1, see Appendix A. Restrictions apply to the availability of the ArQ dataset to maintain the patients\u0026rsquo; rights to anonymity and prevent inappropriate use of data. The data used for this study are available upon reasonable request to the different centres involved.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eIbrahim, J. G., Chu, H. \u0026amp; Chen, L. M. Basic concepts and methods for joint models of longitudinal and survival data. \u003cem\u003eJ Clin Oncol\u003c/em\u003e \u003cstrong\u003e28\u003c/strong\u003e, 2796-2801 (2010). https://doi.org/10.1200/JCO.2009.25.0654\u003c/li\u003e\n\u003cli\u003eHickey, G. L., Philipson, P., Jorgensen, A. \u0026amp; Kolamunnage-Dona, R. joineRML: a joint model and software package for time-to-event and multivariate longitudinal outcomes. \u003cem\u003eBMC Med Res Methodol\u003c/em\u003e \u003cstrong\u003e18\u003c/strong\u003e, 50 (2018). https://doi.org/10.1186/s12874-018-0502-1\u003c/li\u003e\n\u003cli\u003eCampbell, K. R.\u003cem\u003e et al.\u003c/em\u003e Comparison of a time-varying covariate model and a joint model of time-to-event outcomes in the presence of measurement error and interval censoring: application to kidney transplantation. \u003cem\u003eBMC Med Res Methodol\u003c/em\u003e \u003cstrong\u003e19\u003c/strong\u003e, 130 (2019). https://doi.org/10.1186/s12874-019-0773-1\u003c/li\u003e\n\u003cli\u003eElmi, A. F., Grantz, K. L. \u0026amp; Albert, P. S. An approximate joint model for multiple paired longitudinal outcomes and time-to-event data. \u003cem\u003eBiometrics\u003c/em\u003e \u003cstrong\u003e74\u003c/strong\u003e, 1112-1119 (2018). https://doi.org/10.1111/biom.12862\u003c/li\u003e\n\u003cli\u003eKim, S., Buhule, O. D. \u0026amp; Albert, P. S. A Joint Model Approach for Longitudinal Data with no Time-Zero and Time-to-Event with Competing Risks. \u003cem\u003eStat Biosci\u003c/em\u003e \u003cstrong\u003e11\u003c/strong\u003e, 449-464 (2019). https://doi.org/10.1007/s12561-019-09252-4\u003c/li\u003e\n\u003cli\u003eLi, K. \u0026amp; Luo, S. Functional joint model for longitudinal and time-to-event data: an application to Alzheimer\u0026apos;s disease. \u003cem\u003eStatistics in Medicine\u003c/em\u003e \u003cstrong\u003e36\u003c/strong\u003e, 3560-3572 (2017). https://doi.org/10.1002/sim.7381\u003c/li\u003e\n\u003cli\u003eBarrett, J., Diggle, P., Henderson, R. \u0026amp; Taylor-Robinson, D. Joint modelling of repeated measurements and time-to-event outcomes: flexible model specification and exact likelihood inference. \u003cem\u003eJ R Stat Soc Series B Stat Methodol\u003c/em\u003e \u003cstrong\u003e77\u003c/strong\u003e, 131-148 (2015). https://doi.org/10.1111/rssb.12060\u003c/li\u003e\n\u003cli\u003eHartman, N., Kim, S., He, K. \u0026amp; Kalbfleisch, J. D. Pitfalls of the concordance index for survival outcomes. \u003cem\u003eStat Med\u003c/em\u003e \u003cstrong\u003e42\u003c/strong\u003e, 2179-2190 (2023). https://doi.org/10.1002/sim.9717\u003c/li\u003e\n\u003cli\u003eNiedermeyer, S., Murn, M. \u0026amp; Choi, P. J. Respiratory Failure in Amyotrophic Lateral Sclerosis. \u003cem\u003eChest\u003c/em\u003e \u003cstrong\u003e155\u003c/strong\u003e, 401-408 (2019). https://doi.org/10.1016/j.chest.2018.06.035\u003c/li\u003e\n\u003cli\u003eRenton, A. E., Chio, A. \u0026amp; Traynor, B. J. State of play in amyotrophic lateral sclerosis genetics. \u003cem\u003eNat Neurosci\u003c/em\u003e \u003cstrong\u003e17\u003c/strong\u003e, 17-23 (2014). https://doi.org/10.1038/nn.3584\u003c/li\u003e\n\u003cli\u003eProGas Study, G. Gastrostomy in patients with amyotrophic lateral sclerosis (ProGas): a prospective cohort study. \u003cem\u003eLancet Neurol\u003c/em\u003e \u003cstrong\u003e14\u003c/strong\u003e, 702-709 (2015). https://doi.org/10.1016/S1474-4422(15)00104-0\u003c/li\u003e\n\u003cli\u003eStrom, T.\u003cem\u003e et al.\u003c/em\u003e Risk factors for percutaneous endoscopic gastrostomy tube placement during chemoradiotherapy for oropharyngeal cancer. \u003cem\u003eJAMA Otolaryngol Head Neck Surg\u003c/em\u003e \u003cstrong\u003e139\u003c/strong\u003e, 1242-1246 (2013). https://doi.org/10.1001/jamaoto.2013.5193\u003c/li\u003e\n\u003cli\u003eCastrillo-Viguera, C., Grasso, D. L., Simpson, E., Shefner, J. \u0026amp; Cudkowicz, M. E. Clinical significance in the change of decline in ALSFRS-R. \u003cem\u003eAmyotroph Lateral Scler\u003c/em\u003e \u003cstrong\u003e11\u003c/strong\u003e, 178-180 (2010). https://doi.org/10.3109/17482960903093710\u003c/li\u003e\n\u003cli\u003eZajacova, A. \u0026amp; Ailshire, J. Body mass trajectories and mortality among older adults: a joint growth mixture-discrete-time survival analysis. \u003cem\u003eGerontologist\u003c/em\u003e \u003cstrong\u003e54\u003c/strong\u003e, 221-231 (2014). https://doi.org/10.1093/geront/gns164\u003c/li\u003e\n\u003cli\u003eDean, D. O., Bauer, D. J. \u0026amp; Shanahan, M. J. A discrete-time Multiple Event Process Survival Mixture (MEPSUM) model. \u003cem\u003ePsychol Methods\u003c/em\u003e \u003cstrong\u003e19\u003c/strong\u003e, 251-264 (2014). https://doi.org/10.1037/a0034281\u003c/li\u003e\n\u003cli\u003eNylund, K. L., Asparouhov, T. \u0026amp; Muth\u0026eacute;n, B. O. Deciding on the Number of Classes in Latent Class Analysis and Growth Mixture Modeling: A Monte Carlo Simulation Study. \u003cem\u003eStructural Equation Modeling: A Multidisciplinary Journal\u003c/em\u003e \u003cstrong\u003e14\u003c/strong\u003e, 535-569 (2007). https://doi.org/10.1080/10705510701575396\u003c/li\u003e\n\u003cli\u003eMuthen, L. K. \u0026amp; Muth\u0026eacute;n, B. O. \u003cem\u003eMplus : statistical analysis with latent variables : user\u0026apos;s guide\u003c/em\u003e. Version 4. edn, (Muth\u0026eacute;n \u0026amp; Muth\u0026eacute;n, 2006).\u003c/li\u003e\n\u003cli\u003eAlt, H. \u0026amp; Godau, M. COMPUTING THE FR\u0026Eacute;CHET DISTANCE BETWEEN TWO POLYGONAL CURVES. \u003cem\u003eInternational Journal of Computational Geometry \u0026amp; Applications\u003c/em\u003e \u003cstrong\u003e05\u003c/strong\u003e, 75-91 (1995). https://doi.org/10.1142/S0218195995000064\u003c/li\u003e\n\u003cli\u003eLi, J. Y.\u003cem\u003e et al.\u003c/em\u003e Correlation of weight and body composition with disease progression rate in patients with amyotrophic lateral sclerosis. \u003cem\u003eSci Rep\u003c/em\u003e \u003cstrong\u003e12\u003c/strong\u003e, 13292 (2022). https://doi.org/10.1038/s41598-022-16229-9\u003c/li\u003e\n\u003cli\u003eBarnwal, A. C., H; Hocking, T D. Survival regression with accelerated failure time model in XGBoost. (2020). https://doi.org/https://doi.org/10.48550/arXiv.2006.04920\u003c/li\u003e\n\u003cli\u003eQi, S. K., N; Farrokh, M; Sun, W; Kuan, L; Ranganath, R; Henao, R; Greiner, R. in \u003cem\u003eProceedings of the 40th International Conference on Machine Learning.\u003c/em\u003e\u003c/li\u003e\n\u003cli\u003eJanse van Mantgem, M. R.\u003cem\u003e et al.\u003c/em\u003e Prognostic value of weight loss in patients with amyotrophic lateral sclerosis: a population-based study. \u003cem\u003eJ Neurol Neurosurg Psychiatry\u003c/em\u003e \u003cstrong\u003e91\u003c/strong\u003e, 867-875 (2020). https://doi.org/10.1136/jnnp-2020-322909\u003c/li\u003e\n\u003cli\u003eWei, Q.\u003cem\u003e et al.\u003c/em\u003e RNM-01 Weight stability is associated with longer survival in amyotrophic lateral sclerosis. \u003cem\u003eAmyotroph Lateral Scler Frontotemporal Degener\u003c/em\u003e \u003cstrong\u003e20\u003c/strong\u003e, 309-326 (2019). https://doi.org/10.1080/21678421.2019.1647001\u003c/li\u003e\n\u003cli\u003eWesteneng, H. J.\u003cem\u003e et al.\u003c/em\u003e Prognosis for patients with amyotrophic lateral sclerosis: development and validation of a personalised prediction model. \u003cem\u003eLancet Neurol\u003c/em\u003e \u003cstrong\u003e17\u003c/strong\u003e, 423-433 (2018). https://doi.org/10.1016/S1474-4422(18)30089-9\u003c/li\u003e\n\u003cli\u003eENCALS Survival Tools.\u003c/li\u003e\n\u003cli\u003e(ed Neurological clinical research institute).\u003c/li\u003e\n\u003cli\u003eFaggioli, G. M., Stefano; Menotti, Laura; Aidos, Helena; Bergamaschi, Roberto; Birolo, Giovanni; Bosoni, Pietro; Cavalla, Paola; Chi\u0026ograve;, Adriano; Dagliati, Arianna; de Carvalho, Mamede; Di Nunzio, Giorgio Maria; Fariselli, Piero; Garc\u0026iacute;a Dominguez, Jose Manuel; Gromicho, Marta; Guazzo, Alessandro; Longato, Enrico; Madeira, Sara C.; Manera, Umberto; Silvello, Gianmaria,Tavazzi, Eleonora; Tavazzi, Erica; Trescato, Isotta; Vettoretti, Martina; Di Camillo, Barbara; Ferro, Nicola (2023).\u003c/li\u003e\n\u003cli\u003eWhite, I. R., Royston, P. \u0026amp; Wood, A. M. Multiple imputation using chained equations: Issues and guidance for practice. \u003cem\u003eStat Med\u003c/em\u003e \u003cstrong\u003e30\u003c/strong\u003e, 377-399 (2011). https://doi.org/10.1002/sim.4067\u003c/li\u003e\n\u003cli\u003eOh, H. J., Lee, W. J., Sung, J. J., Hong, Y. H. \u0026amp; Pooled Resource Open-Access, A. L. S. C. T. C. Individualized predictions for clinical milestone in amyotrophic lateral sclerosis: A multialgorithmic approach. \u003cem\u003eDigit Health\u003c/em\u003e \u003cstrong\u003e10\u003c/strong\u003e, 20552076241260120 (2024). https://doi.org/10.1177/20552076241260120\u003c/li\u003e\n\u003cli\u003eGuazzo, A.\u003cem\u003e et al.\u003c/em\u003e Predicting clinical events characterizing the progression of amyotrophic lateral sclerosis via machine learning approaches using routine visits data: a feasibility study. \u003cem\u003eBMC Med Inform Decis Mak\u003c/em\u003e \u003cstrong\u003e24\u003c/strong\u003e, 318 (2024). https://doi.org/10.1186/s12911-024-02719-5\u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"","lastPublishedDoi":"10.21203/rs.3.rs-6717675/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6717675/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eHarnessing longitudinal data for time to event analysis can provide valuable insights into disease progression and help plan clinical interventions for individual patients, with the goal of improving clinical outcomes and quality of life. However, real-world clinical data is characterised by missingness, inconsistencies and heterogeneity, especially when datasets are aggregated from different sources. Here, we propose a robust methodological framework to tackle the above challenges and apply it to time to gastrostomy prediction for amyotrophic lateral sclerosis (ALS) patients.\u003c/p\u003e \u003cp\u003eData from 8,586 ALS patients were extracted from three independent cohorts. We determined classes for time-dependent measures of patient decline using joint latent class growth analysis\u0026ndash;discrete time survival analysis (LCGA-DTSA). For new patients, individual trajectories of functional decline were mapped using Fr\u0026eacute;chet distances. Survival and machine learning approaches (Cox Proportinal Hazards, Cox XGBoost, and XGboost Pseudo-Observation Regression) using baseline and longitudinal features were evaluated for predicting time-to-gastrostomy. The best-performing time-to-gastrostomy model was integrated with a time-to-death survival model to provide an overall confidence label.\u003c/p\u003e \u003cp\u003eWe found that the joint LCGA-DTSA enables clear patient stratification by functional decline. The prediction models indicated that rapid decline classes for ALSFRS-R (ALS Functional Rating Scale Revised) bulbar subscore and swallow function are the most important factors determining time-to-gastrostomy insertion. Further, we determined that XGBoost MAEPO model applied on longitudinal features extracted via LCGA-DTSA algorithms outperform every other model in absolute error terms, whilst still providing strong concordance index. Predictions are accompanied with a percentage confidence describing the likelihood of gastrostomy insertion happening given predicted survival time.\u003c/p\u003e \u003cp\u003eLongitudinal trajectories of functional decline can contain crucial information for time-to-event prediction. For declining conditions, such as ALS, appropriate integration of time-to-intervention models with overall survival models could also help inform clinical care and shared decision-making.\u003c/p\u003e","manuscriptTitle":"Machine Learning Framework for Longitudinal Functional Decline and Time-to-Event Prediction","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-06-03 07:09:56","doi":"10.21203/rs.3.rs-6717675/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"5f97c3b1-50fa-41eb-8734-0a81d42bbe77","owner":[],"postedDate":"June 3rd, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[{"id":49191126,"name":"Biological sciences/Neuroscience/Diseases of the nervous system/Amyotrophic lateral sclerosis"},{"id":49191127,"name":"Health sciences/Medical research/Outcomes research"},{"id":49191128,"name":"Physical sciences/Mathematics and computing"}],"tags":[],"updatedAt":"2025-06-03T07:09:58+00:00","versionOfRecord":[],"versionCreatedAt":"2025-06-03 07:09:56","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6717675","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6717675","identity":"rs-6717675","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.