Learn R Programming

BuyseTest (version 1.6)

powerBuyseTest: 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, cpus = 1, alternative = NULL,
  seed = 10, conf.level = 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

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

the various sample sizes in the control group.

sample.sizeT

the various sample sizes in the treatment group.

n.rep

the number of simulations.

cpus

[integer, >0] the number of CPU to use. Only the permutation test can use parallel computation. Default value read from BuyseTest.options().

alternative

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

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().

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?

...

parameters from BuyseTest.

Examples

Run this code
# NOT RUN {
## using simBuyseTest
powerBuyseTest(sim = simBuyseTest, sample.size = c(100), n.rep = 2,
              formula = Treatment ~ tte(eventtime, censoring = status),
              method.inference = "asymptotic", trace = 4)

## using user defined simulation function
simFCT <- function(n.C, n.T){
    out <- data.table(Y=rnorm(n.C+n.T),
                      T=c(rep(1,n.C),rep(0,n.T))
                     )
return(out)
}

powerBuyseTest(sim = simFCT, sample.size = c(100), n.rep = 2,
              formula = T ~ cont(Y), method.inference = "asymptotic", trace = 4)

# }

Run the code above in your browser using DataLab