ZhaoNew_Alloc: Allocation Function of Zhao's New Design for Binary and...

View source: R/CARA_function.R

ZhaoNew_AllocR Documentation

Allocation Function of Zhao's New Design for Binary and Continuous Response

Description

Calculating the probability of assigning the upcoming patient to treatment A based on the patient's predictive covariates and the previous patients' predictive covariates and responses for Zhao's New procedure.

Usage

ZhaoNew_Alloc(
  ptsb.X,
  ptsb.Z,
  ptsb.t,
  ptsb.Y,
  ptnow.X,
  ptnow.Z,
  response,
  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.

ptnow.X

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

ptnow.Z

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

response

the type of the response. Options are "Binary" or "Cont".

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.

Details

This function implements a stratified covariate-adjusted response-adaptive design that balances treatment allocation within and across strata defined by prognostic covariates.

The first 2K patients are randomized using a restricted randomization procedure, with K patients assigned to each treatment. For patient n > 2K, let \mathbf{X}_n denote predictive covariates, and \mathbf{Z}_n denote stratification covariates, placing the patient into stratum (k_1^*, \ldots, k_I^*).

Based on the covariate profiles and responses of the first n-1 patients, we estimate the target allocation probability \widehat{\rho}(\mathbf{X}_n) for the current patient.

If assigned to treatment 1, we compute imbalance measures between actual and target allocation at three levels:

  • Overall imbalance: D_n^{(1)}(\mathbf{X}_n),

  • Marginal imbalance: D_n^{(1)}(i; k_i^*; \mathbf{X}_n),

  • Within-stratum imbalance: D_n^{(1)}(k_1^*, \ldots, k_I^*; \mathbf{X}_n).

These are combined into a weighted imbalance function:

\operatorname{Imb}_n^{(1)}(\mathbf{X}_n) = w_o [D_n^{(1)}(\mathbf{X}_n)]^2 + \sum_{i=1}^I w_{m,i} [D_n^{(1)}(i; k_i^*; \mathbf{X}_n)]^2 + w_s [D_n^{(1)}(k_1^*, \ldots, k_I^*; \mathbf{X}_n)]^2.

A similar imbalance \operatorname{Imb}_n^{(2)}(\mathbf{X}_n) is defined for treatment 2. The patient is then assigned to treatment 1 with probability:

\phi_n = g\left( \operatorname{Imb}_n^{(1)}(\mathbf{X}_n) - \operatorname{Imb}_n^{(2)}(\mathbf{X}_n) \right),

where g(x) is a biasing function satisfying g(-x) = 1 - g(x) and g(x) < 0.5 for x \geq 0. One common choice is Efron's biased coin function:

g(x) = \begin{cases} q, & \text{if } x > 0 \\ 0.5, & \text{if } x = 0 \\ p, & \text{if } x < 0 \end{cases}

with p > 0.5 and q = 1 - p.

This design unifies covariate-adjusted response-adaptive randomization and marginal/stratified balance. It reduces to Hu & Hu's design when \mathbf{X}_n is excluded, and to CARA designs when \mathbf{Z}_n is ignored. More detail can be found in Zhao et al.(2022).

Value

prob

Probability of assigning the upcoming patient to treatment A.

References

Zhao, W., Ma, W., Wang, F., & Hu, F. (2022). Incorporating covariates information in adaptive clinical trials for precision medicine. Pharmaceutical Statistics, 21(1), 176–195.

Examples

set.seed(123)
ptsb.X = sample(c(1, -1), 400, replace = TRUE)
ptsb.Z = cbind(
 sample(c(1, -1), 400, replace = TRUE),
 sample(c(1, -1), 400, replace = TRUE)
)
ptsb.Y = sample(c(1, 0), 400, replace = TRUE)
ptsb.t = sample(c(1, 0), 400, replace = TRUE)

## Incoming patient
ptnow.X = 1
ptnow.Z = c(1, -1)

## Run allocation probability calculation
prob = ZhaoNew_Alloc(
 ptsb.X = ptsb.X,
 ptsb.Z = ptsb.Z,
 ptsb.Y = ptsb.Y,
 ptsb.t = ptsb.t,
 ptnow.X = ptnow.X,
 ptnow.Z = ptnow.Z,
 response = "Binary",
 omega = rep(0.25, 4),
 p = 0.8
)

## View allocation probability for treatment A
prob

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