Learn R Programming

sommer (version 1.3)

fdr: False Discovery Rate calculation

Description

This function calculates the false discovery rate (FDR) at a certain value specified by the user. Is a wrapper of the p.adjust function from the stats package. It has been adjusted to facilitate the user to find the FDR value for a vector of values in scale minus log10.

Usage

fdr(p, fdr.level = 0.05)

Arguments

p
a vector of minus log(p values)
fdr.level
the level of false discovery rate desired

Value

  • [object Object],[object Object],[object Object],[object Object]

References

Benjamini, Y., and Yekutieli, D. 2001. The control of the false discovery rate in multiple testing under dependency. Annals of Statistics 29, 1165-1188.

Examples

Run this code
####=========================================####
#### generate your mickey mouse -log10(p-values)
####=========================================####
set.seed(1253)
pp <- abs(rnorm(500,0,3));pp[23:34] <- abs(rnorm(12,0,20))

####=========================================####
#### see how they look like
####=========================================####
plot(pp, col=transp("cadetblue"), pch=20, cex=1.5)

####=========================================####
#### adjust the values for FDR and see how they look like
####=========================================####
new.pp <- fdr(pp)
plot(new.pp$p.ad, col=transp("cadetblue"), pch=20, cex=1.5)

####=========================================####
#### or you may want to plot your original values 
#### with the FDR line instead
####=========================================####
plot(pp, col=transp("cadetblue"), pch=20, cex=1.5)
abline(h=new.pp$fdr.or, lty=3, col="red", lwd=2)

Run the code above in your browser using DataLab