powerBuyseTest {BuyseTest}R Documentation

Performing simulation studies with BuyseTest

Description

Performs a simulation studies for several sample sizes. Returns estimates, standard errors, confidence intervals and p.values.

Usage

powerBuyseTest(
  sim,
  sample.size,
  sample.sizeC = NULL,
  sample.sizeT = NULL,
  n.rep,
  null = c(netBenefit = 0),
  cpus = 1,
  seed = NULL,
  conf.level = NULL,
  alternative = NULL,
  order.Hprojection = NULL,
  transformation = NULL,
  trace = 1,
  ...
)

Arguments

sim

[function] take two arguments: the sample size in the control group (n.C) and the sample size in the treatment group (n.C) and generate datasets. The datasets must be data.table objects.

sample.size

[integer vector, >0] the various sample sizes at which the simulation should be perform. Disregarded if any of the arguments sample.sizeC or sample.sizeT are specified.

sample.sizeC

[integer vector, >0] the various sample sizes in the control group.

sample.sizeT

[integer vector, >0] the various sample sizes in the treatment group.

n.rep

[integer, >0] the number of simulations.

null

[numeric vector] For each statistic of interest, the null hypothesis to be tested. The vector should be named with the names of the statistics.

cpus

[integer, >0] the number of CPU to use. Default value is 1.

seed

[integer, >0] the seed to consider for the simulation study.

conf.level

[numeric] confidence level for the confidence intervals. Default value read from BuyseTest.options().

alternative

[character] the type of alternative hypothesis: "two.sided", "greater", or "less". Default value read from BuyseTest.options().

order.Hprojection

[integer 1,2] the order of the H-project to be used to compute the variance of the net benefit/win ratio. Default value read from BuyseTest.options().

transformation

[logical] should the CI be computed on the logit scale / log scale for the net benefit / win ratio and backtransformed. Otherwise they are computed without any transformation. Default value read from BuyseTest.options().

trace

[integer] should the execution of the function be traced?

...

other arguments (e.g. scoring.rule, method.inference) to be passed to initializeArgs.

Author(s)

Brice Ozenne

Examples

library(data.table)

#### Using simBuyseTest ####
## only point estimate
powerBuyseTest(sim = simBuyseTest, sample.size = c(10, 50, 100), n.rep = 10,
               formula = treatment ~ bin(toxicity), seed = 10,
               method.inference = "none", trace = 2)

## point estimate with rejection rate
powerBuyseTest(sim = simBuyseTest, sample.size = c(10, 50, 100), n.rep = 10,
               formula = treatment ~ bin(toxicity), seed = 10,
               method.inference = "u-statistic", trace = 4)

#### Using user defined simulation function ####
## Example of power calculation for Wilcoxon test
simFCT <- function(n.C, n.T){
    out <- rbind(cbind(Y=stats::rt(n.C, df = 5), group=0),
                 cbind(Y=stats::rt(n.T, df = 5), group=1) + 1)
    return(data.table::as.data.table(out))
}


## Not run: 
powerW <- powerBuyseTest(sim = simFCT, sample.size = c(5, 10,20,30,50,100),
                         n.rep = 1000, formula = group ~ cont(Y), cpus = "all")
summary(powerW)

## End(Not run) 


[Package BuyseTest version 2.3.0 Index]