Last chance! 50% off unlimited learning
Sale ends in
Performs bootstrap t-test on treatment effects. This test is proposed by Shao et al. (2010) <doi:10.1093/biomet/asq014>.
boot.test(data, B=200, method = c("HuHuCAR", "PocSimMIN", "StrBCD",
"StrPBR", "DoptBCD", "AdjBCD"),
conf = 0.95, …)
a dataframe. It consists of patients' profiles, treatment assignments and outputs. See getData
.
an integer. It indicates the number of bootstrap samples. The default is 200.
a character string specifying the alternative randomization methods to be used in allocating patients, must be one of "HuHuCAR"
(default), "PocSimMIN"
, "StrBCD"
, "StrPBR"
, "DoptBCD"
or "AdjBCD"
.
confidence level of the interval. The default is 0.95
.
arguments to be passed to methods. These depend on the method
used and the following arguments are accepted:
a vector of weights at the overall, within-stratum, and maginal 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.
a vector of weights for marginal 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.
the probabillty of assigning one patient to treatment 1. p
should be larger than 1/2
to obtain balance. Note that p
is only needed when "HuHuCAR", "PocSimMIN"
and "StrBCD"
are to be used.
a design parameter. As a
goes to
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.
It returns an object of class "htest"
.
The function print
is used to obtain results. The generic accessor functions statistic
, p.value
, conf.int
and others extract various useful features of the value returned by boot.test
.
An object of class "htest"
is a list containing at least the following components:
a character string giving the name(s) of the data.
the value of the t-statistic.
the p-value of the test,the null hypothesis is rejected if p-value is less than the pre-determined significance level.
a confidence interval under the chosen level conf
for the difference in treatment effect between treatment 1
and treatment 2
.
the estimated treatment effect difference between treatment 1
and treatment 2
.
a character string indicating what type of test was performed.
The bootstrap t-test is described as follows:
1) Generate bootstrap data (
2) Perform covariate-adaptive procedures on the patients' profiles to obtain new treatment assignments
3) Repeat step 2
Shao J, Yu X, Zhong B. A theory for testing hypotheses under covariate-adaptive randomization[J]. Biometrika, 2010, 97(2): 347-360.
# NOT RUN {
#Suppose the data used is patients' profile from real world,
# while it is generated here. Data needs to be preprocessed
# and then get assignments following certain randomization.
set.seed(100)
df<- data.frame("gender" = sample(c("female", "male"), 100, TRUE, c(1 / 3, 2 / 3)),
"age" = sample(c("0-30", "30-50", ">50"), 100, TRUE),
"jobs" = sample(c("stu.", "teac.", "other"), 100, TRUE, c(0.4, 0.2, 0.4)),
stringsAsFactors = TRUE)
##data preprocessing
data.pd <- StrPBR(data = df, bsize = 4)$Cov_Assig
#Then we need to combine patients' profiles and outcomes after randomization and treatments.
outcome = runif(100)
data.combined = data.frame(rbind(data.pd,outcome), stringsAsFactors = TRUE)
#run the bootstrap t-test
B = 200
Strbt = boot.test(data.combined, B, "StrPBR", bsize = 4)
Strbt
# }
Run the code above in your browser using DataLab