|Bootstrap confidence intervals||R Documentation|
bootCI calculates five different confidence intervals from bootstrap samples: see details:
bootCIlogit calculates corrections on the logit scale and back-transforms.
bootCI(t0, bt, conf = 0.95) bootCIlogit(t0, bt, conf = 0.95)
the statistic estimated from the original sample, usually the output from
a vector of bootstrap statistics, usually the output from
a (single!) confidence interval to estimate.
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 -
“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”:
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.
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).
boot.ci in package
kerinci for an example.
# See ?kerinci
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.