# Harmonic mean p-value

The harmonic mean p-value (HMP) is a statistical technique for addressing the multiple comparisons problem that controls the strong-sense family-wise error rate (this claim has been disputed). It improves on the power of Bonferroni correction by performing combined tests, i.e. by testing whether groups of p-values are statistically significant, like Fisher's method. However, it avoids the restrictive assumption that the p-values are independent, unlike Fisher's method. Consequently, it controls the false positive rate when tests are dependent, at the expense of less power (i.e. a higher false negative rate) when tests are independent. Besides providing an alternative to approaches such as Bonferroni correction that controls the stringent family-wise error rate, it also provides an alternative to the widely-used Benjamini-Hochberg procedure (BH) for controlling the less-stringent false discovery rate. This is because the power of the HMP to detect significant groups of hypotheses is greater than the power of BH to detect significant individual hypotheses.
There are two versions of the technique: (i) direct interpretation of the HMP as an approximate p-value and (ii) a procedure for transforming the HMP into an asymptotically exact p-value. The approach provides a multilevel test procedure in which the smallest groups of p-values that are statistically significant may be sought.

## Direct interpretation of the harmonic mean p-value

The weighted harmonic mean of p-values p$_1$, …, p$_L${\textstyle p_{1}, \dots , p_{L}} is defined as ${\overset {\circ }{p}}={\frac {\sum _{i=1}^{L}w_{i}}{\sum _{i=1}^{L}w_{i}/p_{i}}},$ where w$_1$, …, w$_L${\textstyle w_{1}, \dots , w_{L}} are weights that must sum to one, i.e. ∑$_{i=1}$$^L$w$_i$=1{\textstyle \sum _{i=1}^{L}w_{i}=1}. Equal weights may be chosen, in which case w$_i$=1/L{\textstyle w_{i}=1/L}.
In general, interpreting the HMP directly as a p-value is anti-conservative, meaning that the false positive rate is higher than expected. However, as the HMP becomes smaller, under certain assumptions, the discrepancy decreases, so that direct interpretation of significance achieves a false positive rate close to that implied for sufficiently small values (e.g. ${\overset {\circ }{p}}<0.05$).
The HMP is never anti-conservative by more than a factor of elog⁡L{\textstyle e\, \log L} for small L{\textstyle L}, or log⁡L{\textstyle \log L} for large L{\textstyle L}. However, these bounds represent worst case scenarios under arbitrary dependence that are likely to be conservative in practice. Rather than applying these bounds, asymptotically exact p-values can be produced by transforming the HMP.

## Asymptotically exact harmonic mean p-value procedure

Generalized central limit theorem shows that an asymptotically exact p-value, p$_{p∘}${\textstyle p_{\overset {\circ }{p}}}, can be computed from the HMP, ${\overset {\circ }{p}}$, using the formula $p_{\overset {\circ }{p}}=\int _{1/{\overset {\circ }{p}}}^{\infty }f_{\textrm {Landau}}\left(x\,|\,\log L+0.874,{\frac {\pi }{2}}\right)\mathrm {d} x.$Subject to the assumptions of generalized central limit theorem, this transformed p-value becomes exact as the number of tests, L{\textstyle L}, becomes large. The computation uses the Landau distribution, whose density function can be written$f_{\textrm {Landau}}(x\,|\,\mu ,\sigma )={\frac {1}{\pi \sigma }}\int _{0}^{\infty }{\textrm {e}}^{-t{\frac {(x-\mu )}{\sigma }}-{\frac {2}{\pi }}t\log t}\,\sin(2t)\,{\textrm {d}}t.$The test is implemented by the p.hmp command of the harmonicmeanp R package; a tutorial is available online.
Equivalently, one can compare the HMP to a table of critical values (Table 1). The table illustrates that the smaller the false positive rate, and the smaller the number of tests, the closer the critical value is to the false positive rate.
Table 1. Critical values for the HMP p$^∘${\textstyle {\overset {\circ }{p}}} for varying numbers of tests L{\textstyle L} and false positive rates α{\textstyle \alpha }. :
| L{\textstyle L} | α=0.05{\textstyle \alpha =0.05} | α=0.01{\textstyle \alpha =0.01} | α=0.001{\textstyle \alpha =0.001} |
| 10 | 0.040 | 0.0094 | 0.00099 |
| 100 | 0.036 | 0.0092 | 0.00099 |
| 1,000 | 0.034 | 0.0090 | 0.00099 |
| 10,000 | 0.031 | 0.0088 | 0.00098 |
| 100,000 | 0.029 | 0.0086 | 0.00098 |
| 1,000,000 | 0.027 | 0.0084 | 0.00098 |
| 10,000,000 | 0.026 | 0.0083 | 0.00098 |
| 100,000,000 | 0.024 | 0.0081 | 0.00098 |
| 1,000,000,000 | 0.023 | 0.0080 | 0.00097 |

## Multiple testing via the multilevel test procedure

If the HMP is significant at some level α{\textstyle \alpha } for a group of L{\textstyle L} p-values, one may search all subsets of the L{\textstyle L} p-values for the smallest significant group, while maintaining the strong-sense family-wise error rate. Formally, this constitutes a closed-testing procedure.
When α{\textstyle \alpha } is small (e.g. α<0.05{\textstyle \alpha <0.05}), the following multilevel test based on direct interpretation of the HMP controls the strong-sense family-wise error rate at level approximately α:{\textstyle \alpha :}
* Define the HMP of any subset R{\textstyle {\mathcal {R}}} of the L{\textstyle L} p-values to be${\overset {\circ }{p}}_{\mathcal {R}}={\frac {\sum _{i\in {\mathcal {R}}}w_{i}}{\sum _{i\in {\mathcal {R}}}w_{i}/p_{i}}}.$
* Reject the null hypothesis that none of the p-values in subset R{\textstyle {\mathcal {R}}} are significant if p$^∘$$_R$≤αw$_R${\textstyle {\overset {\circ }{p}}_{\mathcal {R}}\leq \alpha \, w_{\mathcal {R}}}, where w$_R$=∑$_{i∈R}$w$_i${\textstyle w_{\mathcal {R}}=\sum _{i\in {\mathcal {R}}}w_{i}}. (Recall that, by definition, ∑$_{i=1}$$^L$w$_i$=1{\textstyle \sum _{i=1}^{L}w_{i}=1}.)
An asymptotically exact version of the above replaces p$^∘$$_R${\textstyle {\overset {\circ }{p}}_{\mathcal {R}}}in step 2 with $p_{{\overset {\circ }{p}}_{\mathcal {R}}}=\max \left\{{\overset {\circ }{p}}_{\mathcal {R}},w_{\mathcal {R}}\int _{w_{\mathcal {R}}/{\overset {\circ }{p}}_{\mathcal {R}}}^{\infty }f_{\textrm {Landau}}\left(x\,|\,\log L+0.874,{\frac {\pi }{2}}\right)\mathrm {d} x\right\},$ where L{\textstyle L} gives the number of p-values, not just those in subset R{\textstyle {\mathcal {R}}}.
Since direct interpretation of the HMP is faster, a two-pass procedure may be used to identify subsets of p-values that are likely to be significant using direct interpretation, subject to confirmation using the asymptotically exact formula.

## Properties of the HMP

The HMP has a range of properties that arise from generalized central limit theorem. It is:
* Robust to positive dependency between the p-values.
* Insensitive to the exact number of tests, L.
* Robust to the distribution of weights, w.
* Most influenced by the smallest p-values.
When the HMP is not significant, neither is any subset of the constituent tests. Conversely, when the multilevel test deems a subset of p-values to be significant, the HMP for all the p-values combined is likely to be significant; this is certain when the HMP is interpreted directly. When the goal is to assess the significance of individual p-values, so that combined tests concerning groups of p-values are of no interest, the HMP is equivalent to the Bonferroni procedure but subject to the more stringent significance threshold α$_L$<α{\textstyle \alpha _{L}<\alpha } (Table 1).
The HMP assumes the individual p-values have (not necessarily independent) standard uniform distributions when their null hypotheses are true. Large numbers of underpowered tests can therefore harm the power of the HMP.
While the choice of weights is unimportant for the validity of the HMP under the null hypothesis, the weights influence the power of the procedure. Supplementary Methods §5C of and an online tutorial consider the issue in more detail.

## Bayesian interpretations of the HMP

The HMP was conceived by analogy to Bayesian model averaging and can be interpreted as inversely proportional to a model-averaged Bayes factor when combining p-values from likelihood ratio tests.

### The harmonic mean rule-of-thumb

I. J. Good reported an empirical relationship between the Bayes factor and the p-value from a likelihood ratio test. For a null hypothesis H$_0${\textstyle H_{0}} nested in a more general alternative hypothesis H$_A$, {\textstyle H_{A}, } he observed that often,${\textrm {BF}}_{i}\approx {\frac {1}{\gamma \,p_{i}}},\quad 3{\frac {1}{3}}<\gamma <30,$ where BF$_i${\textstyle {\textrm {BF}}_{i}} denotes the Bayes factor in favour of H$_A${\textstyle H_{A}} versus $H_{0}.$ Extrapolating, he proposed a rule of thumb in which the HMP is taken to be inversely proportional to the model-averaged Bayes factor for a collection of L{\textstyle L} tests with common null hypothesis:${\overline {\textrm {BF}}}=\sum _{i=1}^{L}w_{i}\,{\textrm {BF}}_{i}\approx \sum _{i=1}^{L}{\frac {w_{i}}{\gamma \,p_{i}}}={\frac {1}{\gamma \,{\overset {\circ }{p}}}}.$For Good, his rule-of-thumb supported an interchangeability between Bayesian and classical approaches to hypothesis testing.

### Bayesian calibration of p-values

If the distributions of the p-values under the alternative hypotheses follow Beta distributions with parameters $\left(0<\xi _{i}<1,1\right)$, a form considered by Sellke, Bayarri and Berger, then the inverse proportionality between the model-averaged Bayes factor and the HMP can be formalized as${\overline {\textrm {BF}}}=\sum _{i=1}^{L}\mu _{i}\,{\textrm {BF}}_{i}=\sum _{i=1}^{L}\mu _{i}\,\xi _{i}\,p_{i}^{\xi _{i}-1}\approx {\bar {\xi }}\sum _{i=1}^{L}w_{i}\,p_{i}^{-1}={\frac {\bar {\xi }}{\overset {\circ }{p}}},$ where
* μ$_i${\textstyle \mu _{i}} is the prior probability of alternative hypothesis i, {\textstyle i, } such that ∑$_{i=1}$$^L$μ$_i$=1, {\textstyle \sum _{i=1}^{L}\mu _{i}=1, }
* ξ$_i$/(1+ξ$_i$){\textstyle \xi _{i}/(1+\xi _{i})} is the expected value of p$_i${\textstyle p_{i}} under alternative hypothesis i, {\textstyle i, }
* w$_i$=u$_i$/ξ$^¯${\textstyle w_{i}=u_{i}/{\bar {\xi }}} is the weight attributed to p-value i, {\textstyle i, }
* u$_i$=(μ$_i$ξ$_i$)$^{1/(1−ξi)}${\textstyle u_{i}=\left(\mu _{i}\, \xi _{i}\right)^{1/(1-\xi _{i})}} incorporates the prior model probabilities and powers into the weights, and
* ξ$^¯$=∑$_{i=1}$$^L$u$_i${\textstyle {\bar {\xi }}=\sum _{i=1}^{L}u_{i}} normalizes the weights.
The approximation works best for well-powered tests ($\xi _{i}\ll 1$).

### The harmonic mean p-value as a bound on the Bayes factor

For likelihood ratio tests with exactly two degrees of freedom, Wilks' theorem implies that p$_i$=1/R$_i${\textstyle p_{i}=1/R_{i}}, where R$_i${\textstyle R_{i}} is the maximized likelihood ratio in favour of alternative hypothesis i, {\textstyle i, } and therefore p$^∘$=1/R$^¯${\textstyle {\overset {\circ }{p}}=1/{\bar {R}}}, where R$^¯${\textstyle {\bar {R}}} is the weighted mean maximized likelihood ratio, using weights w$_1$, …, w$_L$.{\textstyle w_{1}, \dots , w_{L}.} Since R$_i${\textstyle R_{i}} is an upper bound on the Bayes factor, BF$_i${\textstyle {\textrm {BF}}_{i}}, then 1/p$^∘${\textstyle 1/{\overset {\circ }{p}}} is an upper bound on the model-averaged Bayes factor:${\overline {\textrm {BF}}}\leq {\frac {1}{\overset {\circ }{p}}}.$While the equivalence holds only for two degrees of freedom, the relationship between p$^∘${\textstyle {\overset {\circ }{p}}} and R$^¯$, {\textstyle {\bar {R}}, } and therefore BF$^¯$, {\textstyle {\overline {\textrm {BF}}}, } behaves similarly for other degrees of freedom.
Under the assumption that the distributions of the p-values under the alternative hypotheses follow Beta distributions with parameters $\left(1,\kappa _{i}>1\right),$ and that the weights $w_{i}=\mu _{i},$ the HMP provides a tighter upper bound on the model-averaged Bayes factor:${\overline {\textrm {BF}}}\leq {\frac {1}{e\,{\overset {\circ }{p}}}},$a result that again reproduces the inverse proportionality of Good's empirical relationship.