This function calculates a percentile confidence interval from a bootstrap
sample. It is used by calculate_bootstrap_ci()
.
Arguments
- t
Numeric vector of bootstrap replicates.
- conf
A numeric value specifying the confidence level of the interval. Default is
0.95
(95 % confidence level).- h
A function defining a transformation. The intervals are calculated on the scale of
h(t)
and the inverse functionhinv
applied to the resulting intervals. It must be a function of one variable only. The default is the identity function.- hinv
A function, like
h
, which returns the inverse ofh
. It is used to transform the intervals calculated on the scale ofh(t)
back to the original scale. The default is the identity function. Ifh
is supplied buthinv
is not, then the intervals returned will be on the transformed scale.
Value
A matrix with four columns:
conf
: confidence levelrk_lower
: rank of lower endpoint (interpolated)rk_upper
: rank of upper endpoint (interpolated)ll
: lower confidence limitul
: lower confidence limit
Details
$$CI_{perc} = \left[ \hat{\theta}^*_{(\alpha/2)}, \hat{\theta}^*_{(1-\alpha/2)} \right]$$
where \(\hat{\theta}^*_{(\alpha/2)}\) and \(\hat{\theta}^*_{(1-\alpha/2)}\) are the \(\alpha/2\) and \(1-\alpha/2\) percentiles of the bootstrap distribution, respectively.
Note
This function is adapted from the internal function perc.ci()
in the boot package (Canty & Ripley, 1999).
References
Canty, A., & Ripley, B. (1999). boot: Bootstrap Functions (Originally by Angelo Canty for S) [Computer software]. https://CRAN.R-project.org/package=boot
Davison, A. C., & Hinkley, D. V. (1997). Bootstrap Methods and their Application (1st ed.). Cambridge University Press. doi:10.1017/CBO9780511802843