Survival Analysis with visR using CDISC ADaM Time-To-Event Analysis Dataset (ADTTE)


This tutorial illustrates how a standard time-to-event analysis can be done very efficiently when the data set adheres to the CDISC ADaM standard. A more detailed time-to-event analysis with a more broad overview of visR’s functionality is presented in another vignette.


Global Document Setup

# Metadata Title
DATASET <- paste0("Analyis Data Time-To-Event (ADTTE)")

# Save original options()
old <- options()  

# Global formatting options
options(digits = 3)

# Global ggplot settings

# Global table settings 
options(DT.options = list(pageLength = 10, 
                          language = list(search = 'Filter:'), 
                          scrollX = TRUE))

# load ADTTE from CDISC pilot 

# Restore original options()

Time-to-event analysis

visR includes a wrapper function to easily display summary tables (e.g. tableone)

# Display a summary table (e.g. tableone)
visR::tableone(adtte[,c("TRTP", "AGE")],
         title = "Demographic summary" , datasource = DATASET)
Demographic summary
Total (N=254)
Placebo 86 (33.9%)
Xanomeline High Dose 84 (33.1%)
Xanomeline Low Dose 84 (33.1%)
Mean (SD) 75.1 (8.25)
Median (IQR) 77 (70-81)
Min-max 51-89
Missing 0 (0%)
Data Source: Analyis Data Time-To-Event (ADTTE)

The wrapper function to estimate a Kaplan-Meier curve is compatible with %>% and purrr::map functions without losing traceability of the dataset name inside the call of the object. If a data set adheres to the CDISC ADaM standards, only a stratifier needs to be specified.

# Estimate a survival object
survfit_object <-  adtte %>%
  visR::estimate_KM(data = ., strata = "TRTP")
#> Call: ~survival::survfit(formula = survival::Surv(AVAL, 1 - CNSR) ~ 
#>     TRTP, data = data)
#>                            n events median 0.95LCL 0.95UCL
#> TRTP=Placebo              86     29     NA      NA      NA
#> TRTP=Xanomeline High Dose 84     61     36      25      47
#> TRTP=Xanomeline Low Dose  84     62     33      28      51

Given a survival object, visR includes several functions to quickly extract additional information from the survival object (e.g. test statistics and p-values) and a general function to display a table (render).

# Display test statistics associated with the survival estimate

visR::render(survfit_object %>% get_pvalue(), title = "P-values", datasource = DATASET)
Equality across strata Chisq df p-value
Log-Rank 60.270 2.00 <0.001
Wilcoxon 48.023 2.00 <0.001
Tarone-Ware 41.850 2.00 <0.001
Data Source: Analyis Data Time-To-Event (ADTTE)

A survival object can be plotted using the visR function visr. Additional information like confidence intervals and a risktable can be added to the plot.

# Create and display a Kaplan-Meier from the survival object and add a risktable
visr(survfit_object) %>% 
  visR::add_CI() %>%