We provide SurvivalContour to show the predicted survival or cumulative incidence function (for competing risks data) over time for a single continuous covariate in the form of a contour plot. The estimate for the survival probability is based on the Cox model, the spline model, random survival forest, or parametric survival models, including the generalized Gamma AFT model, the stable generalized Gamma AFT model, the Weibull AFT model, the log-logistic AFT model, and the log-Normal AFT model. The estimate for the cumulative incidence function is based on the Fine-Gray model. For more complex deep neural network-based models, such as DeepHit, due to the intricacy of manual tuning, we suggest users check out our easy-to-use R package, survivalContour.

Options

After successfully loading the data, the Shiny app will ask the user to choose the time variable, event indicator variable, and the main continuous covariate for plotting the contour plot. We will ask the user to specify the range of time and covariate values for plotting the predicted survival or the probability of having the primary event. Users can select their preferred color scheme from a few popular choices, define the name of the continuous variable shown in the plot, and specify if they want to plot the confidence interval for the 3D contour plot. Users can also adjust for other covariates but need to provide 1) whether the covariates are continuous, and 2) the values on which the contour plot for the predicted survival is based.

Plot result in R Shiny app

After clicking the button “Create Plots”, the R Shiny app will automatically produce the colored 2D and 3D contour plots of the predicted survival probability (or probability of having the primary event in the competing risks scenario). It will provide the regression coefficient estimates and p-values for the continuous covariate of interest as well as those for the covariates being adjusted for. It will also give the estimated survival or cumulative incidence function at five quantiles of the covariate. Due to the current limitation of the underlying packages, we do not provide pointwise 95% confidence interval estimates for competing risks data. Users can then download the contour and survival (CIF) plots.

The Shiny app has accommodated several survival models, including the Cox model, the spline model, the generalized Gamma AFT model, the stable generalized Gamma AFT model, the Weibull AFT model, the log-logistic AFT model, and the log-Normal AFT model. The number of knots in the spline model is set to be 4. For parametric AFT models, covariates are placed on the “location’’ parameter of the distribution, typically the”scale” or “rate” parameter, through a linear model, or a log-linear model if this parameter must be positive.

Cox model example

This Veterans’ Administration Lung Cancer dataset is a classic survival analysis dataset imported from the R package “survival”. For the purpose of illustration, we only keep observations using the standard treatment. The continuous covariate Karnofsky performance score (100=good) is a strong predictor of the survival result. There are 69 samples in this example dataset and the event times range from 3 to 553 days with a median of 97.

Here is the result for the veterans’ administration lung cancer dataset.

Interval censored data

The Cox model can handle interval-censored data.

Notice on the confidence interval

We provide 95% pointwise confidence interval for the predicted survival curves at 5 quantiles of the continuous covariate.

Reference

Cox, D. (1972). Regression models and life-tables. Journal of the Royal Statistical Society. Series B (Methodological), 34(2), 187-220. www.jstor.org/stable/2985181

Breslow, N. (1975). Analysis of survival data under the proportional hazards model. International Statistical Review / Revue Internationale De Statistique, 43(1), 45-57. doi:10.2307/1402659

Therneau, T. (2020). A package for survival analysis in R. R package version 3.2-3, https://CRAN.R-project.org/package=survival

Holst K. K., Scheike, T. H. and Hjelmborg J. B. (2016). The Liability Threshold Model for Censored Twin Data. Computational Statistics and Data Analysis 93, pp. 324-335. doi: 10.1016/j.csda.2015.01.014

Scheike, T. H., Holst K. K. and Hjelmborg J. B. (2014). Estimating heritability for cause-specific mortality based on twin studies. Lifetime Data Analysis 20 (2), pp. 210-233. doi: 10.1007/s10985-013-9244-x

Jackson, C. (2016). flexsurv: A Platform for Parametric Survival Modeling in R. Journal of Statistical Software, 70(8), 1-33. doi:10.18637/jss.v070.i08

Cox, C. (2008). The generalized \(F\) distribution: An umbrella for parametric survival analysis. Statistics in Medicine 27:4301-4312.

Cox, C., Chu, H., Schneider, M. F., and Munoz, A. (2007). Parametric survival analysis and taxonomy of hazard functions for the generalized gamma distribution. Statistics in Medicine 26:4252-4374

Jackson, C. H., Sharples, L. D., and Thompson, S. G. (2010). Survival models in health economic evaluations: balancing fit and parsimony to improve prediction. International Journal of Biostatistics 6(1):Article 34.

Nelson, C. P., Lambert, P. C., Squire, I. B., and Jones, D. R. (2007). Flexible parametric models for relative survival, with application in coronary heart disease. Statistics in medicine, 26(30), 5486-5498.

Royston, P. and Parmar, M. (2002). Flexible parametric proportional-hazards and proportional-odds models for censored survival data, with application to prognostic modeling and estimation of treatment effects. Statistics in Medicine 21(1):2175-2197.

Karnofsky, D. A. (1949). The clinical evaluation of chemotherapeutic agents in cancer. Evaluation of Chemotherapeutic Agents 191–205.

The Shiny app allows users to run stratified Cox model based on one categorical covariate. It will generate predicted survival contour plot for each stratum separately.

Stratified Cox model example

In the example dataset, we use the full veteran data set, which contains 69 patients using the standard treatment (median event time 97, 7.2% censoring) and 68 patients using the test treatment (median event time 52.5, 5.9% censoring). The continuous covariate is still Karnofsky performance score. Results are shown by stratum.

Reference

Kalbfleisch, J. D. and Prentice, R. A. (2011). The statistical analysis of failure time data. New York: Wiley

Karnofsky, D. A. (1949). The clinical evaluation of chemotherapeutic agents in cancer. Evaluation of Chemotherapeutic Agents 191–205.

Competing risks example

The PAQUID dataset is from a study exploring functional and cerebral aging with 2561 subjects. The covariate DSST stands for Digit Symbol Substitution Score Test, which ranges from 0 to 70 with a median of 35.

Here is the result for the PAQUID dataset.

Data format

We use the standard format for competing risks in this app, i.e., 0 for censoring, 1 for events of primary interest, and 2 for other types of events. For data with interval censoring, when the event indicator is 0, the upper limit of the observation time interval is ignored; when the exact time of an event is known, users need to add a small number to the upper limit of the observation time interval to avoid having the lower and upper interval equal.

Reference

Fine, J. P. and Gray, R. J.(1999). A proportional hazards model for the subdistribution of a competing risk, Journal of the American Statistical Association, 94:446, 496-509, DOI: 10.1080/01621459.1999.10474144

Breslow, N. (1975). Analysis of survival data under the proportional hazards model. International Statistical Review / Revue Internationale De Statistique, 43(1), 45-57. doi:10.2307/1402659

Gerds, T. A. and Ozenne, B. (2020). riskRegression: risk regression models and prediction scores for survival analysis with competing risks. R package version 2020.02.05. https://CRAN.R-project.org/package=riskRegression

Park, J., Bkoyannis, G., and Yiannoutsos, C. T. (2019). Semiparametric competing risks regression under interval censoring using the R package intccr. Computer Methods and Programs in Biomedicine, 173, 167-176. https://doi.org/10.1016/j.cmpb.2019.03.002

Dartigues, J.-F., Gagnon, M., Barberger-Gateau, P., Letenneur, L., Commenges, D., Sauvel, C., Michel, P., and Salamon, R. (1992). The Paquid epidemiological program on brain ageing. Neuroepidemiology 11 (Suppl. 1), 14–18.

Here we reuse the veteran dataset with random survival forests model. We set the age at 65 and the time between diagnosis and start of the study (in month) at 10, and plot the effect of Karnofsky score on survival. As expected, higher Karnofsky score predicts better survival.

Reference

Ishwaran H. and Kogalur U.B. (2023). Fast Unified Random Forests for Survival, Regression, and Classification (RF-SRC), R package version 3.2.2.

Ishwaran H. and Kogalur U.B. (2007). Random survival forests for R. R News 7(2), 25–31.

Ishwaran H., Kogalur U.B., Blackstone E.H. and Lauer M.S. (2008). Random survival forests. Annals of Applied Statistics. 2(3), 841–860.

Kalbfleisch, J. D. and Prentice, R. A. (2011). The statistical analysis of failure time data. New York: Wiley