Tell me if I am wrong but this is the Benjamini–Hochberg procedure is that simple ?
Code:
# produce a table of FDR using with pval already sorted in increasing order fdr = function(pval){ size=length(pval) if(size<2) return(pval) FDR=c(pval[size]) for( i in 1:(size-1)) FDR=c(FDR,min(pval[size-i]*(size)/(size-i),FDR[i])) return(rev(FDR)) }
Comment