Learn R Programming

slipper (version 0.0.0.9001)

slipper_ci: Bootstrap a function that returns a single number and return a non-parametric confidence interval.

Usage

slipper_ci(df, expr, B = 100, lower = 0.025, upper = 0.975)

Arguments

df

A data frame

expr

A an expression with a function that operates on one or more variables from the data frame.

B

the number of bootstrap samples to draw

lower

the lower percentile for the confidence interval (default 2.5

upperthe upper percentile for the confidence interval (default 97.5

confint A vector with the lower bound and upper bound

Takes a data frame, a function that returns a single number, and a number of replicates and returns a data frame with the function calculated on the observed sample and on B bootstrap samples.

# Boostrap the mean of the mpg variable in the mtcars data set and get a confidence # interval slipper_ci(mtcars,mean(mpg),B=100)

# Bootstrap the mean of the mpg variable with piping mtcars %>% slipper_ci(mean(mpg),B=100)