13.14 The False Discovery Rate
Now we perform hypothesis tests for all 2,000 fund managers in the Fund
dataset.
With one-sample \(t\)-test of \(H_{0j}: \mu_j=0\), which states that the \(j\)th fund manager’s mean return is zero.
<- rep(0, 2000)
fund.pvalues for (i in 1:2000)
<- t.test(Fund[, i], mu = 0)$p.value fund.pvalues[i]
The p.adjust()
function can be used with Benjamini-Hochberg procedure.
<- p.adjust(fund.pvalues, method = "BH")
q.values.BH 1:10] q.values.BH[
## [1] 0.08988921 0.99149100 0.12211561 0.92342997 0.95603587 0.07513802
## [7] 0.07670150 0.07513802 0.07513802 0.07513802
The q-values output by the Benjamini-Hochberg procedure can be interpreted as the smallest FDR threshold.
How many of the fund managers can we reject \(H_{0j}: \mu_j=0\)?
sum(q.values.BH <= .1)
## [1] 146
What if we had instead used Bonferroni’s method to control the FWER at level \(\alpha=0.1\)?
sum(fund.pvalues <= (0.1 / 2000))
## [1] 0
Finally, wh
indexes all \(p\)-values that are less than or equal to the largest \(p\)-value in wh.ps
. Therefore, wh
indexes the \(p\)-values rejected by the Benjamini-Hochberg procedure.
<- sort(fund.pvalues)
ps <- length(fund.pvalues)
m <- 0.1
q <- which(ps < q * (1:m) / m)
wh.ps if (length(wh.ps) >0) {
<- 1:max(wh.ps)
wh else {
} <- numeric(0)
wh }
plot(ps, log = "xy", ylim = c(4e-6, 1), ylab = "P-Value",
xlab = "Index", main = "")
points(wh, ps[wh], col = 4)
abline(a = 0, b = (q / m), col = 2, untf = TRUE)
abline(h = 0.1 / 2000, col = 3)