View source: R/TSDT_scoring_functions.R
survival_time_quantile | R Documentation |
Computes the quantile of a survival function.
survival_time_quantile(data, scoring_function_parameters = NULL)
data |
data.frame containing response data |
scoring_function_parameters |
named list of scoring function control parameters |
Computes the quantile of a survival function. The user specifies the percentile associated with the desired quantile in scoring_function_parameters. The default is percentile = 0.50, which returns the median survival. A user may also specify a value for the trt_arm parameter in scoring_function_parameters to compute the survival quantile for only one arm.
A quantile of the response survival time.
TSDT, diff_survival_time_quantile, Surv, coxph, survfit, survreg, quantile.survfit, predict.coxph, predict.survreg
N <- 200 time <- runif( min = 0, max = 20, n = N ) event <- sample( c(0,1), size = N, prob = c(0.2,0.8), replace = TRUE ) trt <- sample( c('Control','Experimental'), size = N, prob = c(0.4,0.6), replace = TRUE ) df <- data.frame( y = survival::Surv( time, event ), trt = trt ) ## Compute median survival time in Experimental treatment arm. ex1 <- survival_time_quantile( data = df, scoring_function_parameters = list( trt_var = "trt", trt_arm = "Experimental", percentile = 0.50 ) ) ## Compute Q1 survival time for all data. It is necessary here to explicitly ## specify trt = NULL because a variable called trt exists in df. The default ## behavior is to use this variable as the treatment variable. To override ## the default behavior trt = NULL is included in scoring_function_parameters. ex2 <- survival_time_quantile( data = df, scoring_function_parameters = list( trt = NULL, percentile = 0.25 ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.