CARAEE_Alloc_Surv: Allocation Function of CARA Designs Based on Efficiency and...

View source: R/CARA_function.R

CARAEE_Alloc_SurvR Documentation

Allocation Function of CARA Designs Based on Efficiency and Ethics 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 using CARA Designs Based on Efficiency and Ethics for survival trial.

Usage

CARAEE_Alloc_Surv(
  ptsb.cov,
  ptsb.t,
  ptsb.Y,
  ptsb.E,
  ptnow.cov,
  gamma,
  event.prob
)

Arguments

ptsb.cov

a n x k covariate matrix of previous patients.

ptsb.t

a treatment vector of previous patients with length n.

ptsb.Y

a response vector of previous patients with length n.

ptsb.E

a censoring indicator vector (1 = event observed, 0 = censored)with length n.

ptnow.cov

a covariate vector of the incoming patient with length k.

gamma

a non-negative number. A tuning parameter that reflects the importance of the efficiency component compared to the ethics component.

event.prob

a vector with length 2. The probability of events of upcoming patient for two treatments.

Value

prob

Probability of assigning the upcoming patient to treatment A.

Examples

set.seed(123)
n = 40
covariates = cbind(rexp(40),rexp(40))
treatment = sample(c(0, 1), n, replace = TRUE)
survival_time = rexp(n, rate = 1)
censoring = runif(n)
event = as.numeric(survival_time < censoring)

new_patient_cov = c(Z1 = 1, Z2 = 0.5)

result = CARAEE_Alloc_Surv(
 ptsb.cov = covariates,
 ptsb.t = treatment,
 ptsb.Y = survival_time,
 ptsb.E = event,
 ptnow.cov = new_patient_cov,
 gamma=1,
 event.prob = c(0.5,0.7)
)
print(result$prob)

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