get_bh_threshold: Data-driven threshold of Benjamini Hochberg Procedure

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

Given pvalues and a nominal significance level alpha, this function returns the rejection threshold of the Benjamini-Hochberg procedure, i.e. a value t_BH such that p-values with P_i <= t_BH get rejected by the procedure.

Usage

1
get_bh_threshold(pvals, alpha, mtests = length(pvals))

Arguments

pvals

Numeric, vector of p-values

alpha

Numeric in [0,1], significance level of the multiple testing procedure

mtests

Integer, total number of hypothesis tests; only set this (to non-default) when you know what you are doing!

Value

A numeric in [0,1], threshold of the BH procedure

Examples

1
2
3
4
pvalues <- c(runif(1000), rbeta(1000,0.5,7)) # generate some p-values
adj_pvalues <- p.adjust(pvalues, method="BH") # calculate adjusted p-values
t_BH  <- get_bh_threshold(pvalues, 0.1) #get rejection threshold at alpha=0.1
all((pvalues <= t_BH) == (adj_pvalues <= 0.1)) #equivalence of two formulations

IHW documentation built on Nov. 8, 2020, 7:44 p.m.