Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion R/qvalue.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#' will be utilized in the internal calls made in \code{\link{qvalue}}. See \url{http://genomine.org/papers/Storey_FDR_2011.pdf}
#' for a brief introduction to FDRs and q-values.
#'
#' @param p A vector of p-values (only necessary input).
#' @param p A vector of p-values (only necessary input). Note that qvalue expects that these values are uniformly distributed
#' on [0,1), and under default parameter values will throw an error. If your p-value distribution is truncated, qvalue will
#' run with the BH procedure by setting pi0 = 1.
#' @param fdr.level A level at which to control the FDR. Must be in (0,1]. Optional; if this is
#' selected, a vector of TRUE and FALSE is returned that specifies
#' whether each q-value is less than fdr.level or not.
Expand Down Expand Up @@ -94,6 +96,9 @@ qvalue <- function(p, fdr.level = NULL, pfdr = FALSE, lfdr.out = TRUE, pi0 = NUL
} else if (!is.null(fdr.level) && (fdr.level <= 0 || fdr.level > 1)) {
stop("'fdr.level' must be in (0, 1].")
}
if ( max(p) < 0.5 && is.null(pi0) ) {
stop("p-values are truncated and pi0 not set. Try running BH procedure by setting pi0 = 1")
}

# Calculate pi0 estimate
if (is.null(pi0)) {
Expand Down