Returns powers and a plot of the chosen test and method under different treatment effects.
evalPower(n, cov_num, level_num, pr, type, beta, di = seq(0,0.5,0.1), sigma = 1,
Iternum, sl = 0.05, method = c("HuHuCAR", "PocSimMIN", "StrBCD", "StrPBR",
"DoptBCD","AdjBCD"),
test = c("boot.test", "corr.test", "rand.test"), plot = TRUE, ...)
This function returns a list. The first element is a dataframe representing the powers of the chosen test under different values of treatment effects. The second element is the execution time. An optional element is the plot of power in which di
forms the vertical axis.
the number of patients.
the number of covariates.
a vector of level numbers for each covariate. Hence the length of level_num
should be equal to the number of covariates.
a vector of probabilities. Under the assumption of independence between covariates, pr
is a vector containing probabilities for each level of each covariate. The length of pr
should correspond to the number of all levels, and the sum of the probabilities for each margin should be 1
.
a data-generating method. Optional input: "linear"
or "logit"
.
a vector of coefficients of covariates. The length of beta
must correspond to the sum of all covariates' levels.
a value or a vector of values of difference in treatment effects. The default value is a sequence from 0
to 0.5
with increments of 0.1
. The value(s) forms the horizontal axis of the plot.
the error variance for the linear model. The default is 1. This should be a positive value and is only used when type = linear
.
an integer. It is the number of iterations required for power calculation.
the significance level. If the \(p\) value returned by the test is less than sl
, the null hypothesis will be rejected. The default value is 0.05
.
the randomization procedure to be used for power calculation. This package provides power calculation for "HuHuCAR"
, "PocSimMIN"
, "StrBCD"
, "StrPBR"
, "AdjBCD"
, and "DoptBCD"
.
a character string specifying the alternative tests used to verify hypothesis, must be one of "boot.test"
, "corr.test"
or "rand.test"
, which are the bootstrap \(t\) test, the corrected \(t\) test, and the randomization test, respectively. The arguments associated with the testing function can be specified; otherwise, the default value will be used.
a bool. It indicates whether to plot or not. Optional input: TRUE
or FALSE
.
arguments to be passed to method
. These arguments depend on the randomization method used and the following arguments are accepted:
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.
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.
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 design parameter governing the degree of randomness. Note that a
is only needed when "AdjBCD"
is to be used.
the block size for the stratified randomization. It is required to be a multiple of 2. Note that bsize
is only needed when "StrPBR"
is to be used.
an integer. It is the number of bootstrap samples. It is needed only when test
is boot.test
.
an integer. It is the number of randomized replications used in the randomization test. It is needed only when test
is rand.test
.
the number of threads to be used in parallel computation. This is needed only under rand.test
and boot.test
. The default is 1
.
##settings
set.seed(2019)
n = 100#<
Run the code above in your browser using DataLab