ZhaoNew_Alloc_Surv: Allocation Function of Zhao's Design for Survival Response

View source: R/CARA_function.R

ZhaoNew_Alloc_SurvR Documentation

Allocation Function of Zhao's Design for Survival Response

Description

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.

Usage

ZhaoNew_Alloc_Surv(
  ptsb.X,
  ptsb.Z,
  ptsb.t,
  ptsb.Y,
  ptsb.E,
  ptnow.X,
  ptnow.Z,
  omega,
  p = 0.8
)

Arguments

ptsb.X

a vector of length n of the predictive covariates of previous patients. Must be binary.

ptsb.Z

a n x k of the prognostic covariates of previous patients. Must be binary.

ptsb.t

a vector of length n of the treatment allocation of previous patients.

ptsb.Y

a vector of length n of the responses of previous patients.

ptsb.E

a vector of length n with value 1 or 0 of the status of event and censoring.

ptnow.X

a binary value of the predictive covariate of the present patient.

ptnow.Z

a vector of length k of the binary prognostic covariate of the present patient.

omega

a vector of length 2+k. The weight of imbalance.

p

a positive value between 0.75 and 0.95. The probability parameter of Efron's biased coin design.

Value

prob

Probability of assigning the upcoming patient to treatment A.

Examples

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

caradpt documentation built on Aug. 28, 2025, 9:09 a.m.