This Shiny App was developed to easily visualize a survival analysis.
Survival analyses use a set of statistical approaches to investigate the time it takes for an event of interest to occur. The event of interest can be recurrence, remission, progression or death, among others. In Survival studio, two or more groups are compared with respect to the time to this specific event. In some cases, the event may not be observed in some individuals within the study time period, then, this observation would be “censored” and survival time would be the last known time the patient or participant was known not to suffer the event.
Survival analysis use the following methods:
- Kaplan-Meier plots: The Kaplan-Meier plot and it is used to visualize the probability of survival in each of the time intervals.
- Log-Rank Test: The log-rank test compares the Kaplan-Meier survival curves of both groups. Its H0 is that survival curves of two populations do not differ. It is not suitable for continuous predictors.
- Cox Proportional Hazards Regression: Describes the effect of continuous or categorical predictors on survival. Whereas the log-rank test compares two Kaplan-Meier survival curves (i.e. splitting the population into treatment groups), the Cox proportional hazards models considers other covariates when comparing survival of patients groups.
The app has four tabs:
- Analysis set up
- Table of statistics
- Kaplan-Meier Plot
- Cox Model
This R Shiny mini-app reads the data from the data
directory. If you want to work with your own data, just add the desired CSV file to the data
folder and choose it in the app.
You can clone this repository by using the command:
git clone https://github.com/Aridhia-Open-Source/shiny-demo-survival-analysis
Open the .Rproj file in RStudio, source the script dependencies.R
to install all the packages required by the app, and run runApp()
to start the app.
- Download this GitHub repo as a .zip file.
- Create a new blank Shiny app in your workspace called "survival-analysis".
- Navigate to the
survival-analysis
folder underfiles
. - Delete the
app.R
file from thesurvival-analysis
folder. Make sure you keep the.version
file! - Upload the .zip file to the
survival-analysis
folder. - Extract the .zip file. Make sure "Folder name" is left blank and "Remove compressed file after extracting" is ticked.
- Navigate into the unzipped folder.
- Select all content of the unzipped folder, and move it to the
survival-analysis
folder (so, one level up). - Delete the now empty unzipped folder.
- Start the R console and run the
dependencies.R
script to install all R packages that the app requires. - Run the app in your workspace.
For more information visit https://knowledgebase.aridhia.io/article/how-to-upload-your-mini-app/