By calling the function by itself boot.ci
, the script appears. You can then see that the percentile CI is calculated using the function perc.ci
(around line 70). On Github, you can get the package script. Looking for the perc.ci
function, your find this:
perc.ci <- function(t, conf = 0.95, hinv = function(t) t)
#
# Bootstrap Percentile Confidence Interval Method
#
{
alpha <- (1+c(-conf,conf))/2
qq <- norm.inter(t,alpha)
cbind(conf,matrix(qq[,1L],ncol=2L),matrix(hinv(qq[,2]),ncol=2L))
}
Which then leads to the norm.inter
function which seems to be the one creating the vector for extracting the percentiles. Looking for this function in the same Github script tel us:
Interpolation on the normal quantile scale. For a non-integer
order statistic this function interpolates between the surrounding
order statistics using the normal quantile scale. See equation
5.8 of Davison and Hinkley (1997)
So it seems it's using interpolation from a normal distribution explaining why it's different from your totally empirical solution.
boot
andboot.ci
from? – Nate