calcBCa: Calculate BCa

View source: R/calcBootEst.R

calcBCaR Documentation

Calculate BCa

Description

Calculate BCa

Usage

calcBCa(bootObj = NULL, bootStat = NULL, origStat = NULL,
  origData = NULL, bcaA = NULL, alpha = 0.05, ci = TRUE, type = "bca",
  calcStat = NULL, B = 2000, bootPkgCI = FALSE, seed = NULL, ...)

Arguments

bootObj

object of class "boot". Object generated by boot::boot function. Optional if bookPkgCI is TRUE or if bootStat is NULL. If bookPkgCI is TRUE and bootStat is not NULL, then bootObj is used to calculate the confidence interval, rather than bootStat.

bootStat

numeric vector. Bootstrap samples. Optional if bookPkgCI is TRUE. Will have no effect if bootPkgCI is TRUE and bootObj is not NULL.

origStat

numeric. Original sample estimate, i.e. value of calcStat applied to origData.

origData

numeric vector. Original sample. Required if origStat, bootStat or bcaA (if type == "bc" ) not given.

bcaA

numeric. Acceleration constant.

alpha

numeric. Dependent on ci, either 1-alpha is the coverage of the confidence interval or alpha specifies the quantile.

ci

logical. If TRUE, then alpha specifies the width of the confidence interval, and an upper and lower bound are returned. If FALSE, then alpha specifies the quantile, and a single quantile is returned.

type

'bca' or 'bc'. Whether to return BCa or bias-corrected intervals. If type == "bc", it sets bcaA, overriding bcaA as specified in the calcBCa arguments.

calcStat

function. Function of a single variable to calculate for each sample.

B

numeric. Number of bootstrap samples to generate, if required.

bootPkgCI

logical. If TRUE, then only functions from the boot package are used to compute the confidence interval.

seed

numeric vector. If specified, then seed(seed) is called before generating a bootstrap sample.

...

arguments. Passed on to boot::boot, if run.

Value

If ci is TRUE, then a numeric vector of length two is returned with the upper and lower bound of the 1-alpha confidence interval. If ci is FALSE, then a single numeric is returned of the corresponding quantile.

Examples

calcBCa( origData = c( 0.096888, 0.115579, 0.13671, 0.086497, 0.5248, 1.676752, 0.46717, 0.360975, 0.118718 ),
calcStat = mean, bootPkgCI = TRUE )

MiguelRodo/ggboot documentation built on Nov. 9, 2023, 5:45 p.m.