R/fdrThres.R

fdrThres <- function (pval, fdr = 0.05) {
  require(dplyr)
  n <- pval %>% length
  comp <- (pval %>% sort) < ((fdr/n) * (1:n))
  if (min(pval) < (fdr/n)) {
    w1 <- which(!comp)[1]
    return((fdr/n) * w1)
  }
  else {
    return(fdr/n)
  }
}
blogsdon/utilityFunctions documentation built on May 12, 2019, 9:32 p.m.