boot95ci: Calculate a basic bootstrap 95% confidence interval

View source: R/np_utility.R

boot95ciR Documentation

Calculate a basic bootstrap 95% confidence interval

Description

Calculates a basic 95% boostrap confidence interval for an aggregator function

Usage

boot95ci(x, agg = "mean", upper = FALSE, nBoot = 1000L)

Arguments

x

numeric vector

agg

character: A string corresponding to the aggregate or central tendency function to be modeled (eg. median, mean, etc.)

upper

logical: Should the upper or lower confidence interval boundary be returned

nBoot

numeric; An integer value indicating the number of boot strap resampling trails to run. Defaults to 1,000.

Details

This function calculates a bootstrap 95% confidence interval for a aggregator function determined by the agg variable. The number of iterations is hard coded at 1000. The variable upper will cause to return the upper bound of the 95% confidence interval if set to TRUE or the lower bound if set to FALSE.

Value

a number corresponding to the upper or lower bootrap 95% confidence interval of the aggregator function given by agg.

See Also

prepBarData, niceBar, boot, boot.ci

Examples

library(boot)
data(iris)
median(iris$Sepal.Width)
#boot95ci(iris$Sepal.Width,agg="median",upper=FALSE)
#boot95ci(iris$Sepal.Width,agg="median",upper=TRUE)

ZachHunter/NicePlots.R documentation built on Sept. 23, 2023, 4:04 a.m.