Learn R Programming

carat (version 1.3)

AdjBCD: Covariate-adjusted Biased Coin Design

Description

Allocates patients to one of two treatments based on covariate-adjusted biased coin design as proposed by Baldi Antognini A, Zagoraiou M (2011) <Doi:10.1093/biomet/asr021>.

Usage

AdjBCD(data, a = 2)

Arguments

data

a dataframe. A row of the dataframe contains the covariate profile of a certain patient.

a

a design parameter. The default is 2. As a goes to \(\infty\), the design becomes more deterministic.

Value

It returns an object of class "carandom".

The function print is used to obtain results. The generic accessor functions Cov_Assig, Diff, data, All strata and others extract various useful features of the value returned by AdjBCD.

An object of class "carandom" is a list containing at least the following components:

cov_num

number of covariates.

n

number of patients.

Cov_Assign

a (cov_num + 1) * n matrix containing covariate profiles for all patients and the corresponding assignments. The \(i\)th column represents the \(i\)th patient. The first cov_num rows include patients' covariate profiles, and the last row contains the assignment.

All strata

a matrix containing all strata involved.

Diff

a matrix with only one column. There are final differences at the overall, within-stratum, and marginal levels.

Data Type

data type. Real or Simulated.

Details

Consider \(I\) covaraites and \(m_i\) levels for the \(i\)th covariate. \(T_j\) is the assignment of the \(j\)th patient and \(Z_j = (k_1,\dots,k_I)\) indicates the covariate profile of the \(j\)th patient. For convenience, \((k_1,\dots,k_I) and (i;k_i)\) denote stratum and margin respectively. \(D_n(.)\) is the difference between numbers of assigned patients in treatment \(1\) and treatment \(2\) at the corresponding level after \(n\) patients have been assigned.

Let \(F^a\) be a decreasing and symmetric function of \(D_n(.)\), which depends on a design parameter \(a\ge 0\). Then the probability of allocating the \((n+1)\)th patient to treatment 1 is \(F^a(D_n(.))\), where $$F^a(x)=\frac{|x|^a}{|a|^a + 1}, $$ for \(x\le -1\), $$F^a(x)=1 / 2, $$ for \( x = 0\), and $$F^a(x)=\frac{1}{|x|^a + 1},$$ for \(x\ge 1.\) As a goes to \(\infty\), the design becomes more deteministic.

Details of the procedure can be found in Baldi Antognini and M. Zagoraiou (2011).

References

Baldi Antognini A, Zagoraiou M. The covariate-adaptive biased coin design for balancing clinical trials in the presence of prognostic factors[J]. Biometrika, 2011, 98(3): 519-535.

See Also

See AdjBCD.sim for allocating patients with covariate data generating mechanism; See AdjBCD.ui for the command-line user interface.

Examples

Run this code
# NOT RUN {
# a simple use
## Real Data
## create a dataframe
df <- data.frame("gender" = sample(c("female", "male"), 1000, TRUE, c(1 / 3, 2 / 3)), 
                 "age" = sample(c("0-30", "30-50", ">50"), 1000, TRUE), 
                 "jobs" = sample(c("stu.", "teac.", "others"), 1000, TRUE), 
                 stringsAsFactors = TRUE)
Res <- AdjBCD(df, a = 2)
## view the output
Res
# }
# NOT RUN {
  ## view all patients' profile and assignments
  Res$Cov_Assig
  
# }
# NOT RUN {
## Simulated Data
n <- 1000
cov_num <- 3
level_num <- c(2, 3, 5) 
# Set pr to follow two tips:
#(1) length of pr should be sum(level_num);
#(2) sum of probabilities for each margin should be 1.
pr <- c(0.4, 0.6, 0.3, 0.4, 0.3, rep(0.2, times = 5))
# set the design parameter
a <- 1.8
# obtain result
Res.sim <- AdjBCD.sim(n, cov_num, level_num, pr, a)
# }
# NOT RUN {
  # view the assignments of patients
  Res.sim$Cov_Assig[cov_num + 1, ]
  # view the differences between treatment 1 and treatment 2 at all levels
  Res.sim$Diff
  
# }

Run the code above in your browser using DataLab