| fdr.control {GeneTS} | R Documentation |
fdr.control controls the False Discovery Rate (FDR) at a
given level Q.
fdr.control(p, Q=0.05, eta0=1.0, robust=FALSE)
p |
vector of p-values |
Q |
desired FDR level |
eta0 |
proportion of null p-values (default: eta0=1). |
robust |
use small sample approximation for estimating q-values (default: robust=FALSE) |
The FDR is the expected proportion
of false positives (erroneous rejections) among the significant tests (rejections).
fdr.control uses the algorithms described in Benjamini and Hochberg (1995)
and Storey (2002).
For a given vector of p-values and the desired FDR level Q the corresponding p-value
cut-off and the q-values for each hypothesis (see Storey, 2002) are computed.
Notes:
fdr.estimate.eta0).
A list object with the following components:
qvalues |
a vector with the q-values for each hypothesis. |
significant |
a vector with a TRUE/FALSE value for each hypothesis |
num.significant |
number of significant hypotheses. |
pvalue.cutoff |
cutoff level for the individual p-values to obtain the desired control of FDR. Hypotheses whose corresponding p-values are below or equal to this cuttoff level are rejected (i.e. significant). |
Konstantinos Fokianos (http://www.ucy.ac.cy/~fokianos/) and Korbinian Strimmer (http://www.statistik.lmu.de/~strimmer/).
Adapted in part from S-PLUS code by Y. Benjamini (http://www.math.tau.ac.il/~roee/FDR_Splus.txt) and R code from J.D. Storey (http://faculty.washington.edu/~jstorey/).
Benjamini, Y., and Y. Hochberg (1995) Controlling the false discovery rate: a practical and powerful approach to multiple testing. J. Roy. Statist. Soc. B, 57, 289–300.
Storey, J. D. (2002) A direct approach to false discovery rates. J. Roy. Statist. Soc. B., 64, 479–498.
# load mixfdr library
library("GeneTS")
# simulate case-control data
p <- 100 # total number of variables
d <- 20 # number of cases where case and control differs
n <- 5 # sample size per group
r1a <- rnorm(d*n, mean = 3, sd = 1)
r1b <- rnorm((p-d)*n, mean = 0, sd = 1)
r2 <- rnorm(p*n, mean = 0, sd = 1)
x1 <- matrix(c(r1a, r1b), nrow = p, byrow = TRUE) # group 1.
x2 <- matrix(r2, nrow = p, byrow = TRUE) # group 2.
# p-values from t-test
pval <- numeric(p)
for(i in 1:p) pval[i] <- t.test(x1[i, ], x2[i, ])$p.value
# Proportion of null p-values for different methods
fdr.estimate.eta0(pval)
fdr.estimate.eta0(pval, method="adaptive")
fdr.estimate.eta0(pval, method="bootstrap")
fdr.estimate.eta0(pval, method="smoother")
# FDR test on the level 0.05 (assuming eta0=0
fdr.control(pval, Q = 0.05)
# FDR test on the level 0.05 (estimating eta0)
e0 <- fdr.estimate.eta0(pval, method="adaptive")
fdr.control(pval, Q = 0.05, eta0=e0)