Calculate the non-parametric bootstrap confidence interval for a given numeric input and a chosen function.

boot_ci(FUN = NULL, nboot = 100, alpha = 0.05, na.rm = FALSE, ...)

Arguments

FUN

Function to bootstrap. Must return a single value.

nboot

Default 100. Number of iterations to use to estimate the output statistic confidence interval.

alpha

Default 0.05. Numeric value indicating the confidence interval to return. 0.05 will return the 95% confidence interval.

na.rm

Default FALSE. A boolean value indicating whether or not to remove NA values. If missing values are present but not removed the function will output NA.

...

Named arguments passed on to FUN.

Value

A two-long numeric vector containing the bootstrapped confidence interval of the input vector(s).

Examples


# Calculate COD confidence interval
boot_ci(cod, nboot = 100, ratio = ratios_sample$ratio)
#>     2.5%    97.5% 
#> 16.58550 19.02327 

# Calculate PRD confidence interval
boot_ci(
  prd,
  nboot = 100,
  assessed = ratios_sample$assessed,
  sale_price = ratios_sample$sale_price,
  na.rm = FALSE
)
#>     2.5%    97.5% 
#> 1.036356 1.063850