View source: R/TSDT_scoring_functions.R
diff_survival_time_quantile | R Documentation |
Computes the difference in the quantile of a survival function across treatment groups.
diff_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 survival function quantile for the treatment and control arms and returns the difference.
A difference in a survival time quantile across treatment arms.
TSDT, survival_time_quantile, Surv, coxph, survfit, survreg, predict.coxph, predict.survreg
requireNamespace( "survival", quiet = TRUE )
N <- 200
df <- data.frame( y = survival::Surv( runif( min = 0, max = 20, n = N ),
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 ) )
## Compute difference in median survival time between Experimental arm and
## Control arm. It is not actually necessary to provide the value for the
## time_var, trt_var, trt_control, and percentile parameters because these
## values are all equal to their default values. The value are explicitly
## provided here simply for clarity.
ex1 <- diff_survival_time_quantile( data = df,
scoring_function_parameters = list( trt_var = "trt",
trt_control = "Control",
percentile = 0.50 ) )
## Compute difference in Q1 survival time. In this example the default value
## for all scoring function parameters are used except percentile, which here
## takes the value 0.25.
ex2 <- diff_survival_time_quantile( data = df,
scoring_function_parameters = list( percentile = 0.25 ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.