confint2.boot {quest}R Documentation

Bootstrapped Confidence Intervals from a boot Object

Description

confint2.boot is the boot method for the generic function confint2 and computes bootstrapped confidence intervals from an object of class boot (aka an object returned by the function boot. The function is a simple wrapper for the car boot methods for the summary and confint generics. See hist.boot for details on those methods.

Usage

## S3 method for class 'boot'
confint2(obj, boot.ci.type = "perc", level = 0.95, ...)

Arguments

obj

an object of class boot (aka an object returned by the function boot).

boot.ci.type

character vector of length 1 specifying the type of bootstrapped confidence interval to compute. The options are 1) "perc" for the regular percentile method, 2) "bca" for bias-corrected and accelerated percentile method, 3) "norm" for the normal method that uses the bootstrapped standard error to construct symmetrical confidence intervals with the classic formula around the bias-corrected estimate, and 4) "basic" for the basic method. Note, "stud" for the studentized method is NOT an option. See boot.ci for details. Although a more informative link is the following blogpost on bootstrapped confidence intervals with the boot package https://www.r-bloggers.com/2019/09/understanding-bootstrap-confidence-interval-output-from-the-r-boot-package/.

level

double vector of length 1 specifying the confidence level. Must be between 0 and 1.

...

This argument has no use. Technically, it is additional arguments for confint2.boot, but is only included for Roxygen2 to satisfy "checking S3 generic/method consistency".

Details

The bias-corrected and accelerated percentile method (boot.ci.type = "bca") will often fail if the number of bootstrapped resamples is less than the sample size. Even still, it can fail for other reasons. Following car:::confint.boot, confint2.boot gives a warning if the bias-corrected and accelerated percentile method fails for any statistic, and implicitly switches to the regular percentile method to prevent an error. When multiple statistics were bootstrapped, it might be that the bias-corrected and accelerated percentile method succeeded for most of the statistics and only failed for one statistic; however, confint2.boot will switch to using the regular percentile method for ALL the statistics. This may change in the future.

Value

data.frame will be returned with nrow equal to the number of statistics bootstrapped and columns specified below. The rownames are the names in the "t0" element of the boot object (default data.frame rownames if the "t0" element does not have any names). The columns are the following:

est

original parameter estimates

se

bootstrapped standard errors (does not differ by boot.ci.type)

lwr

lower bound of the bootstrapped confidence intervals

upr

upper bound of the bootstrapped confidence intervals

See Also

boot.ci hist.boot

Examples


# a single statistic
mean2 <- function(x, i) mean(x[i], na.rm = TRUE)
boot_obj <- boot::boot(data = attitude[[1]], statistic = mean2, R = 200L)
confint2.boot(boot_obj)
confint2.boot(boot_obj, boot.ci.type = "bca")
confint2.boot(boot_obj, level = 0.99)

# multiple statistics
colMeans2 <- function(dat, i) colMeans(dat[i, ], na.rm = TRUE)
boot_obj <- boot::boot(data = attitude, statistic = colMeans2, R = 200L)
confint2.boot(boot_obj)
confint2.boot(boot_obj, boot.ci.type = "bca")
confint2.boot(boot_obj, level = 0.99)


[Package quest version 0.2.0 Index]