Description Usage Arguments Details Value Author(s) References Examples
Estimates their q-values based on a list of p-values resulting from the simultaneous testing of many hypothesis.
1 | calc_qvalues(pvalues)
|
pvalues |
input the p value |
To control the false discovery rate(FDR), q-value has been widely accepted as an alternative approach for multiple hypothesis testing correction in recent years.
qvalues
chen hongliang
http://bioconductor.org/packages/release/bioc/html/qvalue.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (pvalues)
{
nrows = length(pvalues)
lambdas <- seq(0, 0.95, 0.01)
pi0_hat <- array(0, dim = c(length(lambdas)))
for (l in 1:length(lambdas)) {
count = 0
for (i in 1:nrows) {
if (pvalues[i] > lambdas[l]) {
count = count + 1
}
pi0_hat[l] = count/(nrows * (1 - lambdas[l]))
}
}
f <- unclass(smooth.spline(lambdas, pi0_hat, df = 3))
f_spline <- f$y
pi0 = f_spline[length(lambdas)]
ordered_ps <- order(pvalues)
pvalues <- pvalues
qvalues <- array(0, dim = c(nrows))
ordered_qs <- array(0, dim = c(nrows))
ordered_qs[nrows] <- min(pvalues[ordered_ps[nrows]] * pi0,
1)
for (i in (nrows - 1):1) {
p = pvalues[ordered_ps[i]]
new = p * nrows * pi0/i
ordered_qs[i] <- min(new, ordered_qs[i + 1], 1)
}
for (i in 1:nrows) {
qvalues[ordered_ps[i]] = ordered_qs[i]
}
return(qvalues)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.