bootCI: Confidence interval calculation from bootstrap samples.

View source: R/bootCI.R

Bootstrap confidence intervalsR Documentation

Confidence interval calculation from bootstrap samples.

Description

bootCI calculates five different confidence intervals from bootstrap samples: see details: bootCIlogit calculates corrections on the logit scale and back-transforms.

Usage

bootCI(t0, bt, conf = 0.95)
bootCIlogit(t0, bt, conf = 0.95)

Arguments

t0

the statistic estimated from the original sample, usually the output from overlapEst.

bt

a vector of bootstrap statistics, usually the output from bootEst

conf

a (single!) confidence interval to estimate.

Details

Let t = true value of the statistic,
t0 = estimate of t based on the original sample,
bt = bootstrap estimates.

If bootstrap sampling introduces no bias, E[mean(bt)] = t0, otherwise BS bias = mean(bt) - t0.

Assuming that the original sampling causes the same bias as the bootstrap sampling, we write: mean(bt) - t0 = t0 - t, and hence calculate a bias-corrected estimate, t1 = 2 x t0 - mean(bt).

The percentiles CI, “perc”, gives quantiles of the bootstrap values, interpolated if necessary. However, in general, the bootstrap estimates are biased, so “perc” should be corrected.

“basic” is a bias-corrected version of “perc”, analogous to t1: 2 x t0 - perc.

“norm” gives tail cutoffs for a normal distribution with mean = t1 and sd = sd(bt).

These three are equivalent to the confidence intervals returned by boot::boot.ci. “basic” and “norm” are appropriate if you are using the bias-corrected estimator, t1. If you use the uncorrected estimator, t0, you should use “basic0” or “norm0”:

“basic0” is perc - mean(bt) + t0.

“norm0” gives tail cutoffs as before, but with mean = t0 instead of t1.

The "logit" versions perform the corrections on the logit scale and then back transform. This would be appropriate for probabilities or proportions.

Value

A named matrix with 2 columns for lower and upper limits and a row for each type of estimate. Values will be NA if the bootstrap sample is too small (after removing NAs) for estimation: 40 is the minimum for a 95% confidence interval, 200 for 99% (though for stable estimates you need at least 999 bootstrap estimates, preferably 10,000).

Author(s)

Mike Meredith

See Also

boot.ci in package boot. See kerinci for an example.

Examples

# See ?kerinci

mikemeredith/overlap documentation built on Nov. 26, 2022, 7:11 p.m.