rand.test {carat}R Documentation

Randomization Test

Description

Performs randomization test on treatment effects.

Usage

  rand.test(data, Reps = 200, method = c("HuHuCAR", "PocSimMIN", "StrBCD", 
                                       "StrPBR", "DoptBCD", "AdjBCD"), 
          conf = 0.95, binwidth = 30, ...)

Arguments

data

a data frame. It consists of patients' profiles, treatment assignments and outputs. See getData.

Reps

an integer. It is the number of randomized replications used in the randomization test. The default is 200.

method

the randomization procedure to be used for testing. This package provides tests for "HuHuCAR", "PocSimMIN", "StrBCD", "StrPBR", "AdjBCD", and "DoptBCD".

conf

confidence level of the interval. The default is 0.95.

binwidth

the number of bins for each bar in histogram. The default is 30.

...

arguments to be passed to method. These arguments depend on the randomization method used and the following arguments are accepted:

omega

a vector of weights at the overall, within-stratum, and within-covariate-margin levels. It is required that at least one element is larger than 0. Note that omega is only needed when HuHuCAR is to be used.

weight

a vector of weights for within-covariate-margin imbalances. It is required that at least one element is larger than 0. Note that weight is only needed when PocSimMIN is to be used.

p

the biased coin probability. p should be larger than 1/2 and less than 1. Note that p is only needed when "HuHuCAR", "PocSimMIN" and "StrBCD" are to be used.

a

a design parameter governing the degree of randomness. Note that a is only needed when "AdjBCD" is to be used.

bsize

the block size for stratified randomization. It is required to be a multiple of 2. Note that bsize is only needed when "StrPBR" is to be used.

Details

The randomization test is described as follows: 1) For the observed responses Y_1,\dots,Y_n and the treatment assignments T_1,T_2,\dots,T_n, compute the observed test statistic

S_{obs} = \frac{-\sum_{i=1}^nY_i*(T_i-2)}{n_1}-\frac{\sum_{i=1}^n Y_i*(T_i-1)}{n_0}

where n_1 is the number of patients assigned to treatment 1 and n_0 is the number of patients assigned to treatment 2;

2) Perform the covariate-adaptive randomization procedure to obtain the new treatment assignments and calculate the corresponding test statistic S_i. And repeat this process L times;

3) Calculate the two-sided Monte Carlo p-value estimator

p = \frac{\sum_{l=1}^L I(|S_l|\ge |S_{obs}|)}{L}

Value

It returns an object of class "htest".

An object of class "htest" is a list containing the following components:

p.value

p-value of the test, the null hypothesis is rejected if the p-value is less than sl.

estimate

the estimated difference in treatment effects between treatment 1 and treatment 2.

conf.int

a confidence interval under the chosen level conf for the difference in treatment effect between treatment 1 and treatment 2.

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

statistic

the value of the t-statistic. As the randomization test is a nonparametric method, we cannot calculate the t-statistic, so it is hidden in this result.

References

Ma W, Ye X, Tu F, Hu F. carat: Covariate-Adaptive Randomization for Clinical Trials[J]. Journal of Statistical Software, 2023, 107(2): 1-47.

Rosenberger W F, Lachin J M. Randomization in clinical trials: theory and practice[M]. John Wiley & Sons, 2015.

Examples

##generate data
set.seed(100)
n = 1000
cov_num = 5
level_num = c(2,2,2,2,2)
pr = rep(0.5,10)
beta = c(0.1,0.4,0.3,0.2,0.5,0.5,0.4,0.3,0.2,0.1)
mu1 = 0
mu2 = 0.01
sigma = 1
type = "linear"
p = 0.85

dataS = getData(n, cov_num, level_num, pr, type,
               beta, mu1, mu2, sigma, "StrBCD", p)

#run the randomization test
library("ggplot2")
Strt = rand.test(data = dataS, Reps = 200,method = "StrBCD", 
                conf = 0.95, binwidth = 30,
                p = 0.85)
Strt

[Package carat version 2.2.1 Index]