find.sample.size {FDRsamplesize2} | R Documentation |
Determines the sample size needed to achieve the desired FDR and average power
Description
Determines the sample size needed to achieve the desired FDR and average power by given the proportion of true null hypothesis.
Usage
find.sample.size(alpha, pwr, avepow.func, n0 = 3, n1 = 6, max.its = 50, ...)
Arguments
alpha |
the fixed p-value threshold (scalar numeric) |
pwr |
desired average power (scalar numeric) |
avepow.func |
an R function to compute average power |
n0 |
lower limit for initial sample size range |
n1 |
upper limit for initial sample size range |
max.its |
maximum number of iterations |
... |
additional arguments to average power function |
Value
A list with the following components:
n |
a sample size estimate |
computed.avepow |
average power |
desired.avepow |
desired average power |
alpha |
fixed p-value threshold for multiple testing procedure |
n.its |
number of iteration |
max.its |
maximum number of iteration, default is 50 |
n0 |
lower limit for initial sample size range |
n1 |
upper limit for initial sample size range |
Note
For the test with power calculation based on asymptotic normal approximation, we suggest checking FDRsamplesize2
calculation by simulation.
Examples
#Here, calculating the sample size for the study involving many sign tests
average.power.signtest;
p.adj = 0.001;
p = rep(c(0.8,0.5), c(100,9900));
find.sample.size(alpha = p.adj, pwr = 0.8, avepow.func = average.power.signtest, p = p)