Harmonic Mean p-Value Asymptotic Distribution {harmonicmeanp}R Documentation

The Harmonic Mean p-Value Asymptotic Distribution

Description

Density, distribution function, quantile function and random number generation for the harmonic mean of L p-values under their null hypotheses, i.e. the harmonic mean of L standard uniform random variables, assuming L is large.

Usage

dharmonicmeanp(x, L, log=FALSE)
pharmonicmeanp(x, L, log=FALSE, lower.tail=TRUE)
qharmonicmeanp(p, L, log=FALSE, lower.tail=TRUE)
rharmonicmeanp(n, L)

Arguments

x

The value or vector of values of the harmonic mean p-value, for example calculated from data using function hmp.stat.

L

The number of constituent p-values used in calculating each value of x.

log

If true the log probability is output.

lower.tail

If true (the default) the lower tail probability is returned. Otherwise the upper tail probability.

p

The value or vector of values, between 0 and 1, of the probability specifying the quantile for which to return the harmonic mean p-value.

n

The number of values to simulate.

Value

dharmonicmeanp produces the density, pharmonicmeanp the tail probability, qharmonicmeanp the quantile and rharmonicmeanp random variates for the harmonic mean of L p-values when their null hypotheses are true.

Use qharmonicmeanp(alpha,L) to calculate \alpha_L, the 'harmonic mean p-value threshold', as in Table 1 of Wilson (2019, corrected), where L is the total number of p-values under consideration and alpha is the intended strong-sense familywise error rate.

Author(s)

Daniel J. Wilson

References

Daniel J. Wilson (2019) The harmonic mean p-value for combining dependent tests. Proceedings of the National Academy of Sciences USA 116: 1195-1200.

See Also

p.hmp

Examples

# For a detailed tutorial type vignette("harmonicmeanp")
# Example: simulate from a non-uniform distribution mildly enriched for small \emph{p}-values. 
# Compare the significance of the combined p-value for Bonferroni, Benjamini-Hochberg (i.e. Simes), 
# HMP and (equivalently) MAMML with 2 degrees of freedom.
L = 1000
p = rbeta(L,1/1.5,1)
min(p.adjust(p,"bonferroni"))
min(p.adjust(p,"BH"))
x = hmp.stat(p)
pharmonicmeanp(x,length(p))
p.hmp(p,L=L)
p.mamml(1/p,2,L=L)

# Compute critical values for the HMP from asymptotic theory and compare to direct simulations
L = 100
alpha = 0.05
(hmp.crit = qharmonicmeanp(alpha,L))
nsim = 100000
p.direct = matrix(runif(L*nsim),nsim,L)
hmp.direct = apply(p.direct,1,hmp.stat)
(hmp.crit.sim = quantile(hmp.direct,alpha))

# Compare HMP of p-values simulated directly, and via the asymptotic distribution, 
# to the asymptotic density
L = 30
nsim = 10000
p.direct = matrix(runif(L*nsim),nsim,L)
hmp.direct = apply(p.direct,1,hmp.stat)
hmp.asympt = rharmonicmeanp(nsim,L)
h = hist(hmp.direct,60,col="green3",prob=TRUE,main="Distributions of harmonic mean p-values")
hist(hmp.asympt,c(-Inf,h$breaks,Inf),col="yellow2",prob=TRUE,add=TRUE)
hist(hmp.direct,60,col=NULL,prob=TRUE,add=TRUE)
curve(dharmonicmeanp(x,L),lwd=2,col="red3",add=TRUE)
legend("topright",c("Direct simulation","Asymptotic simulation","Asymptotic density"),
  fill=c("green3","yellow2",NA),col=c(NA,NA,"red3"),lwd=c(NA,NA,2),bty="n",border=c(1,1,NA))

[Package harmonicmeanp version 3.0.1 Index]