survival_time_quantile {TSDT} | R Documentation |
survival_time_quantile
Description
Computes the quantile of a survival function.
Usage
survival_time_quantile(data, scoring_function_parameters = NULL)
Arguments
data |
data.frame containing response data |
scoring_function_parameters |
named list of scoring function control parameters |
Details
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.
Value
A quantile of the response survival time.
See Also
TSDT, diff_survival_time_quantile, Surv, coxph, survfit, survreg, quantile.survfit, predict.coxph, predict.survreg
Examples
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 ) )
[Package TSDT version 1.0.7 Index]