get_bh_threshold: Data-driven threshold of Benjamini Hochberg Procedure

View source: R/helpers.R

get_bh_thresholdR Documentation

Data-driven threshold of Benjamini Hochberg Procedure

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

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

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


nignatiadis/IHW documentation built on Aug. 22, 2023, 2:11 p.m.