View source: R/CARA_function.R
CADBCD_Alloc | 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 Covariate Adjusted Doubly Biased Coin procedure proposed by Zhang and Hu.
CADBCD_Alloc(ptsb.cov, ptsb.t, ptsb.Y, ptnow.cov, v = 2, response, target)
ptsb.cov |
a |
ptsb.t |
a treatment vector of previous patients with length |
ptsb.Y |
a response vector of previous patients with length |
ptnow.cov |
a covariate vector of the incoming patient with length |
v |
a non-negative integer that controls the randomness of CADBCD design. The default value is 2. |
response |
the type of the response. Options are |
target |
the type of optimal allocation target. Options are |
To start, we let \boldsymbol{\theta}_0
be an initial estimate of \boldsymbol{\theta}
, and assign m_0
subjects to each treatment using a restricted randomization.
Assume that m
(with m \geq 2 m_0
) subjects have been assigned to treatments. Their responses \{\boldsymbol{Y}_j, j = 1, \ldots, m\}
and the corresponding covariates \{\boldsymbol{\xi}_j, j = 1, \ldots, m\}
are observed.
We let \widehat{\boldsymbol{\theta}}_m = (\widehat{\boldsymbol{\theta}}_{m, 1}, \widehat{\boldsymbol{\theta}}_{m, 2})
be an estimate of \boldsymbol{\theta} = (\boldsymbol{\theta}_1, \boldsymbol{\theta}_2)
.
For each k = 1, 2
, the estimator \widehat{\boldsymbol{\theta}}_{m, k} = \widehat{\boldsymbol{\theta}}_{m, k}(Y_{j,k}, \boldsymbol{\xi}_j : X_{j,k} = 1, j = 1, \ldots, m)
is based on the observed sample of size N_{m,k}
, that is, \{(Y_{j,k}, \boldsymbol{\xi}_j) : X_{j,k} = 1, j = 1, \ldots, m\}
.
Define \widehat{\rho}_m = \frac{1}{m} \sum_{i=1}^m \pi_1(\widehat{\boldsymbol{\theta}}_m, \boldsymbol{\xi}_i)
and \widehat{\pi}_m = \pi_1(\widehat{\boldsymbol{\theta}}_m, \boldsymbol{\xi}_{m+1})
.
When the (m+1)
-th subject is ready for randomization and the corresponding covariate \boldsymbol{\xi}_{m+1}
is recorded, we assign the patient to treatment 1 with the probability:
\psi_{m+1,1} = \frac{\widehat{\pi}_m \left( \frac{\widehat{\rho}_m}{N_{m,1}/m} \right)^v}
{\widehat{\pi}_m \left( \frac{\widehat{\rho}_m}{N_{m,1}/m} \right)^v+ (1 - \widehat{\pi}_m) \left( \frac{1 - \widehat{\rho}_m}{1 - N_{m,1}/m} \right)^v}
and to treatment 2 with probability \psi_{m+1,2} = 1 - \psi_{m+1,1}
, where v \geq 0
is a constant controlling the degree of randomness—from the most random when v = 0
to the most deterministic when v \rightarrow \infty
. See Zhang and Hu(2009) for more details.
prob |
Probability of assigning the upcoming patient to treatment A. |
Zhang, L. X., Hu, F., Cheung, S. H., & Chan, W. S. (2007). Asymptotic properties of covariate-adjusted response-adaptive designs. Annals of Statistics, 35(3), 1166–1182.
Zhang, L. X., & Hu, F. F. (2009). A new family of covariate-adjusted response adaptive designs and their properties. Applied Mathematics—A Journal of Chinese Universities, 24(1), 1–13.
set.seed(123)
n_prev = 40
covariates = cbind(Z1 = rnorm(n_prev), Z2 = rnorm(n_prev))
treatment = sample(c(0, 1), n_prev, replace = TRUE)
response = rbinom(n_prev, size = 1, prob = 0.6)
# Simulate new incoming patient
new_patient_cov = c(Z1 = rnorm(1), Z2 = rnorm(1))
# Run allocation function
result = CADBCD_Alloc(
ptsb.cov = covariates,
ptsb.t = treatment,
ptsb.Y = response,
ptnow.cov = new_patient_cov,
response = "Binary",
target = "Neyman"
)
print(result$prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.