MyNixOS website logo
Description

Computing Power and Sample Size for the False Discovery Rate in Multiple Applications.

Defines a collection of functions to compute average power and sample size for studies that use the false discovery rate as the final measure of statistical significance. A three-rectangle approximation method of a p-value histogram is proposed to derive a formula to compute the statistical power for analyses that involve the FDR. The methodology paper of this package is under review.

FDRsamplesize2

The goal of FDRsamplesize2 is to computer the average power and determine the sample size needed to achieve desired FDR and desired average power. For power calculation, the package covers various statistical test settings,including:

  • two-samples $t$-test
  • one-sample $t$-test
  • rank-sum test
  • signed-rank test
  • Fisher’s exact test
  • the $t$-test for correlation
  • comparison of two Poisson distributions
  • comparison of two negative binomial distributions
  • the two-proportions $z$-test
  • one-way ANOVA
  • Cox proportional hazards regression

Installation

You can install FDRsamplesize2 from github:

# install.packages("devtools")
devtools::install_github("yonghui-ni/FDRsamplesize_2.0")

Or from CRAN:

install.packages("FDEsamplesize2")

Load package

load the package

library("FDRsamplesize2")

Example

This is an example which shows you how to determine the sample size necessary to identify genes with microarray expression signals that are associated with progression-free survival. A single-predictor Cox regression model will be used to test the association of each gene’s expression with progression-free survival (PFS). We are interested in determining the number of events necessary to identify 80% of genes truly associate with PFS while controlling the FDR at 10% in a setting in which 1% of the genes have a hazard ratio of 2 and a variance of 1.

log.HR=log(rep(c(1,2),c(9900,100)))   # log hazard ratio for each gene
v=rep(1,10000)                        # variance of each gene
res=n.fdr.coxph(fdr=0.1, pwr=0.8,logHR=log.HR, v=v, pi0.hat="BH")
res
#> $n
#> [1] 37
#> 
#> $computed.avepow
#> [1] 0.8139159
#> 
#> $desired.avepow
#> [1] 0.8
#> 
#> $desired.fdr
#> [1] 0.1
#> 
#> $input.pi0
#> [1] 0.99
#> 
#> $alpha
#> [1] 0.0008879023
#> 
#> $n0
#> [1] 36
#> 
#> $n1
#> [1] 37
#> 
#> $n.its
#> [1] 7
#> 
#> $max.its
#> [1] 50

Step by step to calculate power and sample size. This procedure is more flexible for user to plug in average power function of other statistical tests that are not available in FDRsamplesize2.

pi0=9900/10000                      # proportion of true null hypothesis
adj.p=alpha.power.fdr(fdr=0.1,
                       pwr=0.8,
                       pi0=pi0,
                       method="BH")
print(adj.p)
#> [1] 0.0008879023

find.sample.size(alpha=adj.p,                       # Fixed p-value threshold     
                 pwr=0.8,                           # Power of single α-level test
                 avepow.func=average.power.coxph,   # an R function to compute average power  
                 n0=3,                              # Lower limit for initial sample size range
                 n1=6,                              # Upper limit for initial sample size range
                 logHR=log(rep(c(1,2),c(9900,100))),
                 v=rep(1,10000), 
                 max.its=50                         # Maximum number of iterations, default is 50
                 )
#> $n
#> [1] 37
#> 
#> $computed.avepow
#> [1] 0.8139159
#> 
#> $desired.avepow
#> [1] 0.8
#> 
#> $alpha
#> [1] 0.0008879023
#> 
#> $n.its
#> [1] 7
#> 
#> $max.its
#> [1] 50
#> 
#> $n0
#> [1] 36
#> 
#> $n1
#> [1] 37

To get the fixed p-value threshold $\alpha$ in alpha.power.fdr function for multiple testing procedure, approximation method options include:

  • Benjamini and Hochberg 1995 (BH)
  • Jung 2005 (Jung)
  • p-value histogram height (HH)
  • p-value histogram mean (HM)

package updates

  • 0.2.0 version:

add fdr.avepow() to compute FDR and average power for a given sample size and effect size vector;

add fdr.power.alpha() to compute FDR for given p-value threshold, average power and proportion of tests with a true null.

Metadata

Version

0.2.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows