View source: R/CARA_function.R
ZhaoNew_Alloc_Surv | R Documentation |
Calculating the probability of assigning the upcoming patient to treatment A based on the patient's covariates and the previous patients' covariates and responses for Zhao's New procedure for survival trials.
ZhaoNew_Alloc_Surv(
ptsb.X,
ptsb.Z,
ptsb.t,
ptsb.Y,
ptsb.E,
ptnow.X,
ptnow.Z,
omega,
p = 0.8
)
ptsb.X |
a vector of length |
ptsb.Z |
a |
ptsb.t |
a vector of length |
ptsb.Y |
a vector of length |
ptsb.E |
a vector of length |
ptnow.X |
a binary value of the predictive covariate of the present patient. |
ptnow.Z |
a vector of length |
omega |
a vector of length |
p |
a positive value between 0.75 and 0.95. The probability parameter of Efron's biased coin design. |
prob |
Probability of assigning the upcoming patient to treatment A. |
set.seed(123)
# Generate historical data for 400 patients
ptsb.X = sample(c(1, -1), 400, replace = TRUE) # predictive covariate
ptsb.Z = cbind(
sample(c(1, -1), 400, replace = TRUE), # prognostic covariate 1
sample(c(1, -1), 400, replace = TRUE) # prognostic covariate 2
)
ptsb.Y = rexp(400, rate = 1) # survival time (response)
ptsb.E = sample(c(1, 0), 400, replace = TRUE) # event indicator (1 = event, 0 = censored)
ptsb.t = sample(c(1, 0), 400, replace = TRUE) # treatment assignment
# Incoming patient covariates
ptnow.X = 1
ptnow.Z = c(1, -1)
# Allocation probability calculation
prob = ZhaoNew_Alloc_Surv(
ptsb.X = ptsb.X,
ptsb.Z = ptsb.Z,
ptsb.Y = ptsb.Y,
ptsb.E = ptsb.E,
ptsb.t = ptsb.t,
ptnow.X = ptnow.X,
ptnow.Z = ptnow.Z,
omega = rep(0.25, 4),
p = 0.8
)
# View the allocation probability for treatment A
prob
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.