scieee AI-readable full text Open interactive document viewer

Analysis of complex survival data: a tutorial using the Shiny MSM.app application

Gustavo Soutinho; Machado, Luís Meira

Abstract

The development of applications for obtaining interpretable results in a simple and summarized manner in multi-state models is a research field with great potential, namely in terms of using open source tools that can be easily implemented in biomedical applications. In this tutorial, we introduce MSM.app, an interactive web application using the Shiny package for the R language. In the following sections, we present the main functionalities of the MSM.app and an explanation of the outputs obtained for better understanding, independent of the statistical knowledge of users.

Full text

Analysis of Complex Survival Data: a tutorial using the Shiny MSM.app application Gustavo Soutinho1and Lu´ıs Meira-Machado2 1EPIUnit - University of Porto Rua das Taipas 135, 4050-600 Porto - Portugal, [email protected] 2Centre of Mathematics, University of Minho, lmac[email protected] Keywords: R language, Shiny package, Survival analysis, Multi-state models. The development of applications for obtaining interpretable results in a simple and summarized manner in multi-state models is a research field with great potential, namely in terms of using open source tools that can be easily implemented in biomedical applications. In this tutorial, we introduce MSM.app, an interactive web application using the Shiny package for the R language. In the following sections, we present the main functionalities of the MSM.app and an explanation of the outputs obtained for better understanding, independent of the statistical knowledge of users. 1. What is the Shiny MSM.app? The appearance of the shiny R package allowed to automatically share results obtained from the Rlanguage to be analyzed for users without any prior knowledge in terms of informatics via the internet [1, 2, 3]. In this context, the MSM.app web application arises with the goal of carrying out an analysis of multi-state survival data sets. Among its functionalities, we can highlight the possibility to conduct a traditional survival analysis regarding the following topics: (i) estimation of survival functions (using the classical Kaplan-Meier estimator); (ii) comparison of survival functions between groups; and (iii) use of semi-parametric and parametric regression models to study the relationship between explanatory variables and survival time. 1 arXiv:2202.09160v1 [stat.CO] 18 Feb 2022 The MSM.app can also be used for the analysis of multi-state survival data that can be seen as a generalization of survival analysis in which survival is the ultimate outcome of interest but where information is available about intermediate events that individuals may experience during the study period [4, 5, 6]. To this statistical analysis, the Shiny MSM.app application combines shiny with some other packages such as survival [7], mstate [8] and survidm [9]. 2. Features of the Shiny MSM.app The MSM.app is a web application that was developed to perform dynamic analysis through a set of dynamic web forms, tables, and graphics. It is built upon two components: the user-interface scripts for the layout of the application where the outputs are displayed (ui.R); and the other given by the server scripts with the instructions of the application (server.R) [10]. Among the main aspects of this Shiny web tool that improve the flexibility and productivity, we could highlight the easy rendering of the contents without multiple reloads, the feature to add computed (or processed) outputs from R scripts, or interactively add reports and visualizations. The MSM.app also provides integration with other Rpackages, javascript libraries or CSS customization, being under the GPL-2 open source license. The communication between the client and server is done over the normal TCP connection [11]. 3. How is the Shiny MSM.app different from other applications? There exists a set of available web tools specifically aimed at carrying out some parts of multi-state analysis. Among them, we can stand out the MSDshiny which provides a useful and streamlined way to plan and power clinical trials with multi-state outcomes such as a view of the multi-state structure, treatment effects, or the results of different types of simulations. Another example is MSM-shiny application. This tool uses a CSV file containing multi-state data and provides the modeling and comparison of transition hazard models and the prediction of occupation probabilities [12]. Recently, MSMplus provides a flexible visualization of the transition probabilities, transition intensities, or probability of visiting a particular state [13]. 2 After analyzing existing web applications, we have concluded that their use by non-statisticians has been limited. A possible reason for this is the lack of friendly software that covers the main goals involving survival analysis and multistate models on the same platform. The MSM.app allows users to explore various types of multi-state models and perform regression inference as well as obtain several predictive measures of interest, such as the occupation probabilities, the transition probabilities, and the cumulative incidence functions. Recent methods for checking the Markov assumption are also implemented. 4. How to get the Shiny MSM.app The Shiny MSM.app is available for free open access at the Shiny Apps repository https://gsoutinho.shinyapps.io/appmsm/. 5. Structure of the Shiny MSM.app The web application consists of three parts representing different aspects of the survival analysis and its extension to complex multi-state models. The first one allows to perform the survival analysis from mainly of most common functions of the survival Rpackages. The second enables one to obtain some of the main goals of a multi-state analysis, such as the inference of regression models and the estimation of transition probabilities, through the survidm and mstate R packages. Finally, MSM.app also includes local and global statistical tests to check the Markov assumption for multi-state using the markovMSM package. 6. Type of input data files and requirements The MSM.app only requires CSV files as input. By default, in terms of structure, the values of the data set should be separated by a comma. However, files that use a semicolon to separate the values are also accepted. Three examples of data sets are available for consultation in the MSM.app from which it is possible to check the requirements that the files must have to pursue the data analysis. Each one corresponds to a specific type of structure of data: survival, illness-death model, or more general multi-state models. The first data set corresponds to survival data in patients with acute myelogenous leukemia [14]. Figure 1 shows some registers and the three 3 columns that the file must have. “Time1” and “status” correspond to the time to the event and the status of the censoring, respectively. “x” is the only covariate in this data that can be used for regression or obtaining the survival estimates for groups. Figure 1: Structure of the CSV files for survival analysis (given by the aml data set). The second corresponds to a data set from a clinical trial on colon cancer, which can be modeled using the progressive illness-death model [15]. Figure 2 shows the schematic diagram of transitions involved in the model. Among the variables of the colonIDM data set, the first four correspond to the times or the status indicator for the illness-death model. “time1” represents the sojourn time in the initial state and “Stime” and “event1” and “event” the corresponding censoring indicates. The other variables could be used for transition probabilities or to check the effect on the transition intensities (Figure 3). Figure 2: Illness-death model for the colon cancer study. Finally, extensions to progressive processes beyond the three-state illnessdeath model are discussed using data from the European Group for Blood 4 Figure 3: Structure of the CSV files for Illness-death models analysis (given by the colonIDM data set). and Marrow Transplantation (EBMT) [4]. The movement of the patients among the six states can be modelled through the multi-state model with the following six states: ‘Alive and in remission, no recovery or adverse event’ (State 0); ‘Alive in remission, recovered from the treatment’ (state 1); ‘Alive in remission, occurrence of the adverse event’ (state 2); ‘Alive, both recovered and adverse event’ (state 3); ‘Alive, in relapse’ (treatment failure) (state 4) and ‘Dead (treatment failure)’ (state 5). In total there are 12 transitions, three intermediate events given by recovery (Rec), adverse event (AE) and a combination of the two (AE and Rec), and two absorbing states: Relapse and Death (Figure 4). Figure 4: A six-states model for leukemia patients after bone marrow transplantation. 5 In terms of format, the CSV file should be in wide format. In the case of the ebmt4 data (Figure 5), the transition times from the initial to the ultimate state (‘srv’) or to the intermediate states (‘rec’, ‘ae’, ‘recae’ and ‘rel’), and the corresponding censoring variables are rec.s’, ‘ae.s’, ‘recae.s’, ‘rel.s’ and ‘srv.s’. Other variables correspond to the covariates for regression models. Figure 5: Structure of the CSV files for multi-state models analysis (given by the ebmt4 data set). For all these data sets, the names of the variables could be different. In these cases, the user must correctly indicate the corresponding name in the web forms of the application. The data files can be accessed at https: //w3.math.uminho.pt/~lmachado/shiny/. 7. How to select the input files? On the “input files” page we can find an interactive form. For each type of data set (“survival data”, “illness-death model”, or “multi-state model”), a new web form appears below the radio buttons, in which we indicate the times to the events or the status indicator (Figure 6, left hand side and center). In case of the more complex multi-state models, it is also necessary to indicate the transition schema as well as the number of states, for instance (Figure 6, right hand side). After submitting a data set, a table appears on the right hand side of the page which can be dynamically. This table can be changed using filters or by searching for specific words in the table. Figure 7 shows a partial view the veteran data set that can be found in the survival package. 6 Figure 6: The event time and status variables for the survival analysis from the veteran data set (left); an indication of the two event times and their corresponding status for the illness-death model given by the colonIDM data (center); and a description of the MSM model through the number and the state names, the transition schema, and the event times and corresponding status for the ebmt4 data (right). Figure 7: The input file page with the data table with some results for the veteran data set and three radio buttons for each type of model. 8. How to carry out a Survival analysis? From the “survival analysis” button, we can carry out the classical methods for survival analysis. In this section, we analyze the main aspects of the outputs displayed on the right sides of the pages: Kaplan-Meier estimator, Compare survival curves, Cox PH models and parametric models, by using the veteran data set. Kaplan-Meier estimator Non-parametric estimation of the survival function is traditionally performed using the Kaplan-Meier estimator, which can be desegregated for 7 different groups of categorical variables. By default, a summary of the estimates is presented on the right side. Figure 8 shows, respectively, times with events, the number of individuals at risk at that time, and the survival estimates with corresponding standard errors and confidence intervals. It is also possible to display an interactive plot of the survivals with (or without) the confidence interval intervals (Figure 9). Figure 8: Summary of the survival estimation for the categorical covariate “celltype” of the veteran data set using the Kaplan-Meier estimator. Compare survival curves Statistical tests can be used to compare survival rates between groups. The null hypothesis states that there is no difference in survival between groups. The log-rank test and the Gehan-Wilcoxon test are the most commonly used. Both tests are available in the MSM.App. The output of the tests comprises the chi-squared statistics, degrees of freedom, and the corresponding p-value. The number of individuals for each group and the number of observed and expected values are also presented. Results of Figure 10 show significant differences in the survival curves among groups given by the cell types (p <0.0001). Cox PH models The semi-parametric Cox proportional hazards model [16] is usually used to evaluate the effects of several factors on survival. The output for the Cox model is updated as the user selects the variables to be included in the model in the web form. Figure 11 shows, respectively, the estimate of the coefficients 8 Figure 9: The output of the survival estimation for the categorical covariate “celltype” of the veteran data set using the Kaplan-Meier estimator. Survival curves for each group with confidence intervals could be shown at the bottom by choosing “Yes”. for the covariates “celltype”, Karnofsky performance score (“karno”) and “age”; the hazard ratio given by exp(coef) and the respective standard error; and the statistical significance of the model. Result of the global test for the proportional hazards assumption confirms that this requirement is no fulfilled and consequently a parametric accelerated failure time (AFT) model must be preferable to be fitted to this survival data. Parametric AFT models The idea behind the outputs for parametric survival models is quite similar to those provided by the Cox PH models. In this case, six possibilities of distributions are available to model the baseline hazard function of the models: exponential, weibull, gaussian, logistic, lognormal or loglogistic. Besides the summary of the models, the Akaike Information Criterion (AIC) values are also presented to make it easier to compare which model fits better to assess the effect of several risk factors on survival time. Figures 12, 13 and 14 show, respectively, the outputs of the AFT models given by the exponential, weibull and loglogistic distributions. Through the AUC values we can assume that loglogistic parametric model is preferable. From this model, we can observe that only “age” and “small cells” do not have a significant effect 9 Figure 17: ANOVA results for transitions 0 −→ 1 and 0 −→ 2 with the following covariates: “rx”, “sex”, “age”, “obstruct” and “perfor” of the colonIDM. A Markovian process is assumed. regression purposes. Local tests Two types of methods are available for checking the local tests of the Markov condition: (i) the AUC method, which is based on measuring the discrepancy between the AJ estimator of the transition probabilities (which provides consistent estimates when the process is Markovian) and the landmark estimators (which are free of the Markov condition). In this case, the web tool uses the LM estimator for the progressive illness-death models and LMAJ in the case of more complex MSM models; (ii) the Log-rank method, which considers summaries from families of log-rank statistics where patients are grouped by the state occupied at different times. For both types of models (IDM and MSM), the output using the AUC is the same. As an example, in Figure 26, we obtained the p-values for the local tests based on the stimes 365, 730, 1095, 1460, and 1825 for the transition from state 2 to state 3. Results were obtained for an IDM model based on the colon cancer data using 100 replicas. Even though the web form is quite similar to the AUC local test, the output of the log-rank test only provides the results for a specific transition and the times chosen (Figure 27). 16 Figure 18: The proportional hazards assumption was tested for the transitions 0 →1 and 0 →2 with the following covariates: “rx”, “sex”, “age”, “obstruct” and “perfor” of the colonIDM. A Markovian process is assumed. Global tests In the MSM.app application, three global tests are available for both IMD and more complex MSM models: (i) the first one is based on Cox models, from which it is possible to evaluate the effect of history on the process. In this case, this can be done by checking the significance of the covariate time until entering the first state of a particular transition. As illustrated in Figure 28, we can conclude that there is no effect of the time spent in the initial state on the transition 2 →3 (p-value = 0.1543195), which does not induce the failure of the Markovianity. (ii) the recent proposed global test propose [25], based on the area under the curves (AUC), can be used. This test is based on the (AUC) local test results for specific percentiles. The outputs on the right hand of Figure 29 shows the proportion of rejections of the test for all possible transitions between state 1 and state 5. (iii) it is also possible to use the global test based on the log-rank statistics [26] throughout the similar steps of the previous methods, after selecting Log-rank in the radio button HTML element. The outputs provide only the results of the tests for each transition (Figure 30). 17 Figure 19: Results of the estimates of the transition probabilities and the corresponding confidence intervals for s= 365 and times 730, 1090, 1460, and 1825 days for the colonIDM data set using the landmark estimators. Acknowledgements This research was financed within the research grants PTDC/MAT-STA /28248/2017 and PD/BD/142887/2018. References [1] Wojciechowski, J., Hopkins, A. and Upton, R. Interactive pharmacometric applications using R and the Shiny package. CPT: pharmacometrics & systems pharmacology, 4(3), 146–159; 2015 [2] Chang, W. Web Application Framework for R, CRAN; 2017 [3] Kaushik, S. Creating Interactive data visualization using Shiny App in R (with examples), Analytics Vidhya; 2016 [4] Putter, H., Fiocco, M. and Geskus, R.B. Tutorial in biostatistics: Competing risks and multi-state models, Statistics in Medicine, 26(11), 2389– 2430. 18 Figure 20: Transition probability estimates with confidence intervals for each transition for s= 365 using the landmark estimators. [5] Meira-Machado, L., de U˜na-´ Alvarez, J. and Cadarso-Su´arez, C. and Andersen, P.K. Multi-state models for the analysis of time to event data. Statistical Methods in Medical Research, 18, 195–222; 2009. [6] Meira-Machado, L. and Sestelo, M. Estimation in the progressive illnessdeath model: A nonexhaustive review. Biometrical Journal, 61 (2), 245– 263; 2019. [7] Therneau, T.M. A Package for Survival Analysis in R. https://CRAN.R- project.org/ package=survival; 2021. [8] Putter, H., de Wreede, L.C., Fiocco, M., Geskus, R.B., Bonneville, E.F., Manevski, D. mstate: Data Preparation, Estimation and Prediction in Multi-State Models. The R Journal; 2020. [9] Soutinho, G., Sestelo, M. and Meira-Machado, L. survidm: An R package for Inference and Prediction in an Illness-Death Model. The R Journal, Accept for publication; 2021. [10] Govan, P. eAnalytics: Dynamic Web-based Analytics for the Energy Industry. Journal of Open Research Software, 4: e45; 2016. DOI: http://dx.doi.org/10.5334/jors.144 19 Figure 21: Results of the estimates of the transition probabilities and the corresponding confidence intervals for s= 365 and times 730, 1090, 1460, and 1825 days for the colonIDM data set using the Breslow estimator. [11] Seal, A., Wild, D.J. Netpredictor: R and Shiny package to perform Drug-Target Bipartite network analysis and prediction of missing links. Cold Spring Harbor Laboratory; 2016. doi: https://doi.org/10.1101/080036 [12] Lacy, S. msm-shiny, https://stulacy.shinyapps.io/msm-shiny/; 2021 [13] Skourlis, N., Crowther, M.J., Andersson , T., Lambert, P.C. MSMplus, https://nskbiostatistics.shinyapps.io/MSMplus/; 2021 [14] Miller, R.G. Survival Analysis. John Wiley & Sons; 1997 [15] Moertel, G., Fleming, T.R., Macdonald, J.S., Haller, D.G., Laurie, J.A., Goodman, P.J., Ungerleider, J.S., Emerson, W.A., Tormey, D.C., Glick, J.H., Veeder, M.H. and Mailliard, J.A., Levamisole and fluorouracil for adjuvant therapy of resected colon carcinoma. New England Journal of Medicine, 322(6):352–358; 1990 [16] Cox, D.R. Regression models and life tables. Journal of the Royal Statistical Society Series B, 34, 187–220; 1972. 20 Figure 22: Cumulative recurrence incidence with 95% bootstrap confidence intervals. Data from a colon cancer study. [17] Aalen, O., Johansen, S. An empirical transition matrix for non homogeneous Markov and chains based on censored observations. Scandinavian Journal of Statistics, 5: 141–150; 1978. [18] de U˜na-´ Alvarez, J. and Meira-Machado, L. Nonparametric estimation of transition probabilities in the non-markov illness-death model: A comparative study. Biometrics, 71(2), 364–375; 2015. [19] Meira-Machado, L. Smoothed landmark estimators of the transition probabilities. SORT-Statistics and Operations Research Transactions, Figure 23: The number of transitions among the states of the ebmt4 data set. 21 Figure 24: The output of the Cox regression model for the transition 1 →2 that include the ‘year”, “age” and “proph” covariates. ebmt4 data set. Figure 25: Estimates of all possible transition probabilities from the state 1 to 5, for s= 365 and times equal to 730, 1095, 1460, and 1825 using the AJ estimators. ebmt4 data set. 22 Figure 26: Results of the local test for the illness-death model using the colon cancer data set, for s= 365, 730, 1095, 1460, and 1825 days, using the AUC test, from state 1 to state 3. 40: 375–398; 2016. [20] Putter, H. and Spitoni, C. Non-parametric estimation of transition probabilities in non-markov multistate models: The landmark aalenjohansen estimator. Statistical Methods in Medical Research, 27, 2081– 2092; 2018. [21] Moreira, A., de U˜na-´ Alvarez, J. and Meira-Machado, L. Presmoothing the aalen-johansen estimator inthe illness-death model. Electronical Journal of Statistics; 2013, 7:1491–1516. DOI: https://doi.org/10.1214/13-EJS816. [22] Ara´ujo A, Meira-Machado L, Roca-Pardi˜nas J (2014). “TPmsm: Estimation of the Transition Probabilities in 3-State Models.” Journal of Statistical Software, 62(4), 1–29. doi: 10.18637/jss.v062.i04. 23 Figure 27: Results of the local test for the illness-death model using the colon cancer data set, for s= 365, 730 and 1460 days, using the Log-rank test, for state 2 to state 3. [23] Meira-Machado, L., de U˜na-´ Alvarez, J. and Datta, S. Nonparametric estimation of conditional transition probabilities in a non-Markov illness-death model. Computational Statistics, 2015, 30(2), 377–397. doi: https://doi.org/10.1007/s00180-014-0538-6 [24] Kalbfleisch, J. D. and Prentice R. L. The statistical analysis of failure time data. John Wiley & Sons; 1980. [25] Soutinho, G. and Meira-Machado, L. Methods for checking the Markov condition in multi-state survival data. Comput Stat; 2021. https://doi.org/10.1007/s00180-021-01139-7 [26] Titman, A. and Putter, H. General tests of the Markov property in multi-state models. Biostatistics; 2020. doi:10.1093/biostatistics/kxaa030. 24 Figure 28: Results for this global test given by the Cox PH model to our data indicated that the effect of the time spent in State 1 is not significant (p-value of 0.154), revealing no evidence against the Markov model for the colon data set. Figure 29: Outputs of the global test for the illness-death model based on the ebmt data set using the AUC test, from state 1 to state 5. Results for the AUC local test are also shown. 25