Learn R Programming

FDRsampsize (version 1.0)

fdr.sampsize: Determine sample size required to achieve a desired average power while controlling the FDR at a specified level.

Description

Determines the sample size needed to achieve a desired average power while controlling the FDR at a specified level.

Usage

fdr.sampsize (fdr, ave.pow, pow.func, eff.size, null.effect, max.n = 500, min.n = 5, tol = 1e-05, eps = 1e-05, lam = 0.95, ...) "print"(x,...)

Arguments

fdr
Desired FDR (scalar numeric)
ave.pow
Desired average power (scalar numeric)
pow.func
Character string name of function to compute power; must accept n, alpha, and eff.size as its first three arguments. Other optional arguments may also be provided.
eff.size
Numeric vector of effect sizes; interally, this will be provided as the third argument of pow.func
null.effect
Scalar value of the effect size under the null hypothesis. This may be 0 or 1 for tests that respectively use differences or ratios for comparisons.
max.n
Maximum n to consider
min.n
Minimum n to consider
tol
Tolerance for bisection calculations
eps
Epsilon for numerical differentiation
lam
Lambda for computing anticipated pi0 estimate, see Storey 2002.
x
result of the fdr.sampsize function
...
additional arguments for pow.func

Value

e returns an object of class 'FDRsampsize', which is a list with the following components:
OK
indicates if the requirement is met
n
the computed sample size
alpha
the p-value threshold that gives the desired FDR
fdr.hat
anticipated value of the FDR estimate given n and effect size
act.fdr
actual expected FDR given n and effect size
ave.pow
average power
act.pi
actual value of pi0, the proportion of tests with a true null hypothesis.
pi.hat
expected value of the pi0 estimate
eff.size
input effect size vector

Details

This function checks the technical conditions regarding whether the desired FDR can be achieved by min.n or max.n before calling n.fdr. Thus, for most applications, fdr.sampsize should be used instead of n.fdr.

References

A Onar-Thomas, S Pounds. "FDRsampsize: An R package to Perform Generalized Power and Sample Size Calculations for Planning Studies that use the False Discovery Rate to Measure Significance", Manuscript 2015. Pounds, Stan, and Cheng Cheng. "Sample size determination for the false discovery rate." Bioinformatics 21.23 (2005): 4263-4271. Jung, Sin-Ho. "Sample size for FDR-control in microarray data analysis." Bioinformatics 21.14 (2005): 3097-3104.

Examples

Run this code
 power.twosampt             # show the power.cox function
 res=fdr.sampsize(fdr=0.1,
                  ave.pow=0.8,
                  pow.func=power.twosampt,
                  eff.size=rep(c(1,0),c(10,990)),
                  null.effect=0)
 res
 

Run the code above in your browser using DataLab