Wrapper function for historical data from time-to-event outcome.

historical_survival(
  time = NULL,
  treatment = NULL,
  event = NULL,
  discount_function = "identity",
  alpha_max = 1,
  fix_alpha = FALSE,
  weibull_scale = 0.135,
  weibull_shape = 3,
  method = "fixed",
  .data = NULL
)

Arguments

time

vector. exposure time for the subjects. It must be the same length as the treatment variable.

treatment

vector. Treatment assignment for patients, 1 for treatment group and 0 for control group

event

vector. The status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2 = death). For censored data, the status indicator is 0 = right censored, 1 = event at time. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event.

discount_function

character. If incorporating historical data, specify the discount function. Currently supports the Weibull function (discount_function = "weibull"), the scaled-Weibull function (discount_function = "scaledweibull"), and the identity function (discount_function = "identity"). The scaled-Weibull discount function scales the output of the Weibull CDF to have a maximum value of 1. The identity discount function uses the posterior probability directly as the discount weight. Default value is "identity". See bdpnormal for more details.

alpha_max

scalar. Maximum weight the discount function can apply. Default is 1. For a two-arm trial, users may specify a vector of two values where the first value is used to weight the historical treatment group and the second value is used to weight the historical control group.

fix_alpha

logical. Fix alpha at alpha_max? Default value is FALSE.

weibull_scale

scalar. Scale parameter of the Weibull discount function used to compute alpha, the weight parameter of the historical data. Default value is 0.135. For a two-arm trial, users may specify a vector of two values where the first value is used to estimate the weight of the historical treatment group and the second value is used to estimate the weight of the historical control group. Not used when discount_function = "identity".

weibull_shape

scalar. Shape parameter of the Weibull discount function used to compute alpha, the weight parameter of the historical data. Default value is 3. For a two-arm trial, users may specify a vector of two values where the first value is used to estimate the weight of the historical treatment group and the second value is used to estimate the weight of the historical control group. Not used when discount_function = "identity".

method

character. Analysis method with respect to estimation of the weight parameter alpha. Default method "mc" estimates alpha for each Monte Carlo iteration. Alternate value "fixed" estimates alpha once and holds it fixed throughout the analysis. See the the bdpsurvival vignette
vignette("bdpsurvival-vignette", package="bayesDP") for more details.

.data

NULL. Stores the historical time, treatment and event. Should not be edited by the user.

Value

A list with historical data for time-to-event outcome with the discount function.

Examples

historical_survival(time = rexp(10, 0.01), treatment = rep(10, 1), event = rep(10, 1))
#> $time0 #> [1] 176.510947 38.145170 35.041701 13.600901 124.153229 30.068780 #> [7] 62.919241 221.487791 5.366065 52.694965 #> #> $treatment0 #> [1] 10 #> #> $event0 #> [1] 10 #> #> $discount_function #> [1] "identity" #> #> $alpha_max #> [1] 1 #> #> $fix_alpha #> [1] FALSE #> #> $weibull_scale #> [1] 0.135 #> #> $weibull_shape #> [1] 3 #> #> $method #> [1] "fixed" #>