2025-02-12

Benjamini-Hochberg Method

  • Used to control the False Discovery Rate (FDR)
  • Used in multiple hypothesis testing
  • Commonly used in genomics, medical research, and finance

False Discovery Rate (FDR)

  • The False Discovery Rate is defined as the expected proportion of false positives, given that at least one null hypothesis is rejected: \[ \text{FDR} = E\left[\frac{V}{R} \mid R > 0\right] P(R > 0) \]
  • \(V\) = False positives
  • \(R\) = Total rejected null hypotheses

Benjamini-Hochberg Algorithm

  1. Rank p-values in ascending order \(p_{(1)} \leq p_{(2)} \leq ... \leq p_{(m)}\)
  2. Calculate thresholds for each \(i\)-th ranked p-value \[ \frac{i}{m} \cdot q \]
  • \(m\) = total number of hypotheses tested
  • \(q\) = desired FDR threshold (usually 0.05)
  1. Find largest index rank \(k\) such that \(p_{(k)} \leq \frac{k}{m} \cdot q\)
  2. Reject all false positives \(p_i\) for \(i \leq k\)

Benjamini-Hochberg Example

  • Making a plot of randomly generated p-values
library(ggplot2)
set.seed(123)
pvals <- rbeta(500, shape1 = 1, shape2 = 10)
df <- data.frame(pvals)
ggplot(df, aes(x = pvals)) +
  geom_histogram(fill = "darkgreen", color = "black", 
                 bins = 20, alpha= 0.7, boundary = 0) +
  scale_x_continuous(expand = c(0, 0)) +
  scale_y_continuous(expand = c(0, 0)) +
  theme_minimal(base_size = 14) +
  labs(title = "Histogram of p-values", 
       x = "p-value", 
       y = "Frequency")

Example Plot

BH Threshold

m <- 500 # number of tests
pvals <- sort(rbeta(m, shape1 = 1, shape2 = 10))  # Sorted p-values
df <- data.frame(rank = 1:m, pvals = pvals)

#calculate bh threshold
q <- 0.05 # desired FDR
df$bh_threshold <- df$rank / m * q

ggplot(df, aes(x = rank, y = pvals)) +
  geom_point(color = "maroon") + # p values
  geom_line(aes(y = bh_threshold), color = "darkgreen") + #bh threshold
  geom_hline(yintercept = 0.05, linetype="dashed", color="black") + 
  theme_minimal() +
  labs(title = "Benjamini-Hochberg Threshold",
       x = "Rank of p-value",
       y = "p-value")

BH Threshold Plot

  • p-values below the BH threshold line are true positives

Interactive Plot