lastbin: Histogram estimator of p-value density evaluated at 1
Description
This function reports the density estimate of the right most bin of histogram of p-values.
Usage
lastbin(p, bw = 0.2, trunc = TRUE)
Arguments
p
a numeric vector the p-values
bw
numeric, the bin width of histogram of p-values
trunc
logical, indicating if the resulting estimate should be truncated to within [0,1].
Value
a single numeric value as the estimate.
Details
This is a very fast and cheap estimate of p-value density at one, with a slight positive bias,
because it is only an unbiased estimate of density at the bin center, not the right bin edge.
But this is usually ignorable. The function is defined as:
function(p,bw=.2,trunc=TRUE)
if(trunc)max(min(1,mean(p>=1-bw)/bw),0) else mean(p>=1-bw)/bw.