Title: | Covariate-Adjusted Adaptive Randomization via Mahalanobis-Distance |
---|---|
Description: | In randomized controlled trial (RCT), balancing covariate is often one of the most important concern. CARM package provides functions to balance the covariates and generate allocation sequence by covariate-adjusted Adaptive Randomization via Mahalanobis-distance (ARM) for RCT. About what ARM is and how it works please see Y. Qin, Y. Li, W. Ma, H. Yang, and F. Hu (2022). "Adaptive randomization via Mahalanobis distance" Statistica Sinica. <doi:10.5705/ss.202020.0440>. In addition, the package is also suitable for the randomization process of multi-arm trials. For details, please see Yang H, Qin Y, Wang F, et al. (2023). "Balancing covariates in multi-arm trials via adaptive randomization" Computational Statistics & Data Analysis.<doi:10.1016/j.csda.2022.107642>. |
Authors: | Haoyu Yang [aut], Fanglu Chen [aut, cre], Yichen Qin [aut], Yang Li [aut] |
Maintainer: | Fanglu Chen <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.0 |
Built: | 2025-02-24 04:17:48 UTC |
Source: | https://github.com/fanglu-chen/carm |
The CARM package provides function of implement of randomization:
please ?ARM and ?ARMM to view function usage
Allocates patients to one of two treatments using Adaptive Randomization via Mahalanobis Distance proposed by Yichen Qin,Yang Li, Wei Ma, Haoyu Yang, and Feifang Hu.(2022)
ARM(covariate, assignment, q = 0.75)
ARM(covariate, assignment, q = 0.75)
covariate |
a data frame. A row of the dataframe corresponds to the covariate profile of a patient. |
assignment |
a vector. If partial patients had been allocated , please input their allocation. IF all the patients are not be allocated, please input 'assignment = NA' directly. |
q |
the biased coin probability.
|
Suppose that patients are to be assigned to two treatment groups.
Consider
continuous covariates for each patient.
is the assignment of the
th patient.
The proposed procedure to assign units to treatment groups, namely adaptive
randomization via Mahalanobis distance (ARM), is outlined below.
(1) Arrange all units randomly into a sequence
.
(2) Assign the first two units with and
.
(3) Suppose that units have been assigned to
treatment groups,
for the
-th and
-th units:
(3a) If the -th unit is assigned to treatment 1 and
the
-th
unit to treatment 2, then calculate the potential
Mahalanobis distance, between the updated treatment groups.
with
units,
.
(3b) Similarly, if the -th unit is
assigned to treatment 2 and
the
-th unit to treatment 1, then calculate the
other potential Mahalanobis distance,
.
(4) Assign the -th unit to treatment groups
according to the
following probabilities:
if ,
;
if ,
;
if ,
.
(5) Repeat the last two steps until all units are assigned. If n is odd, assign the last unit to two treatments with equal probabilities.
Mahalanobis distance between the sample means across
different treatment groups is:
See the reference for more details.
An object of class "ARM" is a list containing the following components:
assignment |
Allocation of patients. |
sample_size |
The number of patients in treatment 1 and treatment 2 respectively. |
Mahalanobis_Distance |
Mahalanobis distance between treatment groups 1 and 2. |
Qin, Y., Y. Li, W. Ma, H. Yang, and F. Hu (2022). Adaptive randomization via mahalanobis distance. Statistica Sinica.DOI:<10.5705/ss.202020.0440>.
library(MASS) #simulate covariates of patients p <- 6; n <- 30 sigma <- diag(p); mean <- c(rep(0,p)) data <- mvrnorm(n, mean, sigma) covariate <- as.data.frame(data) #IF all the patients are not be allocated ARM(covariate = covariate, assignment = NA, q=0.75) #IF you had allocated partial patients ARM(covariate = covariate,assignment = c(1,2),q=0.75)
library(MASS) #simulate covariates of patients p <- 6; n <- 30 sigma <- diag(p); mean <- c(rep(0,p)) data <- mvrnorm(n, mean, sigma) covariate <- as.data.frame(data) #IF all the patients are not be allocated ARM(covariate = covariate, assignment = NA, q=0.75) #IF you had allocated partial patients ARM(covariate = covariate,assignment = c(1,2),q=0.75)
Randomize patients into treatment groups for multi-arm trials using ARMM proposed by Haoyu Yang, Yichen Qin, Yang Li, Fan Wang, and Feifang Hu.(2022)
ARMM(covariate, assignment, K, q = 0.75, method)
ARMM(covariate, assignment, K, q = 0.75, method)
covariate |
a data frame. A row of the dataframe corresponds to the covariate profile of a patient. |
assignment |
a vector. If partial patients had been allocated , please input their allocation. IF all the patients are not be allocated, please input 'assignment = NA' directly. |
K |
an integer; number of arms of the trial. |
q |
the biased coin probability.
|
method |
Methods for calculating Mahalanobis distance, input one of these texts: 'mean', 'max' or 'median'. |
Suppose units (participants) are to be assigned to
treatment groups. For each unit
and
treatment
, define the assignment
matrix
, where
indicates unit
receives treatment
.
Consider
continuous covariates, let
.
The proposed method, namely the adaptive randomization via Mahalanobis distance for multi-arm design (ARMM), is outlined below. The implement of ARMM is similar to ARM.
First assume that units are in a sequence
and then assign the first
units to
treatment
groups randomly
as the initialization. Then,
the following units are assigned in blocks of
sequentially and
adaptively until all the units
are assigned. For
units are assigned to
groups, there are in total
possible allocations.
Calculate
potential overall
covariate imbalance measurement
according to pairwise Mahalanobis
distance under the
possible allocations.
Choose the allocation which corresponds to the smallest
Mahalanobis
distance with a probability of
across all potential allocations.
Repeat the process until all units are assigned.
For any pair of treatments and
among the
treatment groups, calculate the Mahalanobis distance by:
In total, there are pairs of Mahalanobis
distances among
treatment groups.Finally, calculate
the mean, the median or the maximum to represent the total imbalance.
See the reference for more details.
An object of class "ARMM" is a list containing the following components:
assignment |
Allocation of patients. |
sample_size |
The number of patients from treatment 1 to treatment |
Mahalanobis_Distance |
Mahalanobis distance among treatment groups . |
Yang H, Qin Y, Wang F, et al. Balancing covariates in multi-arm trials via adaptive randomization. Computational Statistics & Data Analysis, 2023, 179: 107642. https://doi.org/10.1016/j.csda.2022.107642
library(MASS) #simulate covariates of patients p <- 6; n <- 30 sigma <- diag(p); mean <- c(rep(0,p)) data <- mvrnorm(n, mean, sigma) covariate <- as.data.frame(data) #IF all the patients are not be allocated ARMM(covariate = covariate, assignment = NA, K = 3, q = 0.75, method = 'mean') #IF you had allocated partial patients ARMM(covariate = covariate, assignment = c(1,2), K=4, q=0.75, method = 'max')
library(MASS) #simulate covariates of patients p <- 6; n <- 30 sigma <- diag(p); mean <- c(rep(0,p)) data <- mvrnorm(n, mean, sigma) covariate <- as.data.frame(data) #IF all the patients are not be allocated ARMM(covariate = covariate, assignment = NA, K = 3, q = 0.75, method = 'mean') #IF you had allocated partial patients ARMM(covariate = covariate, assignment = c(1,2), K=4, q=0.75, method = 'max')