Learn R Programming

CarletonStats (version 2.2)

bootPaired: Bootstrap paired data

Description

Perform a bootstrap of two paired variables.

Usage

bootPaired(x, ...)

# S3 method for default bootPaired( x, y, conf.level = 0.95, B = 10000, plot.hist = TRUE, xlab = NULL, ylab = NULL, title = NULL, plot.qq = FALSE, x.name = deparse(substitute(x)), y.name = deparse(substitute(y)), seed = NULL, ... )

# S3 method for formula bootPaired(formula, data, subset, ...)

Value

The command returns a vector with the replicates of the statistic being bootstrapped.

Arguments

x

a numeric vector.

...

further arguments to be passed to or from methods.

y

a numeric vector.

conf.level

confidence level for the bootstrap percentile interval.

B

number of resamples (positive integer greater than 2).

plot.hist

logical. If TRUE, plot the histogram of the bootstrap distribution.

xlab

an optional character string for the x-axis label

ylab

an optional character string for the y-axis label

title

an optional character string giving the plot title

plot.qq

logical. If TRUE, a normal quantile-quantile plot of the replicates will be created.

x.name

Label for variable x

y.name

Label for variable y

seed

optional argument to set.seed

formula

a formula y ~ x where x, y are both numeric vectors

data

a data frame that contains the variables given in the formula.

subset

an optional expression indicating what observations to use.

Methods (by class)

  • bootPaired(default): Perform a bootstrap of two paired variables.

  • bootPaired(formula): Perform a bootstrap of two paired variables.

Author

Laura Chihara

Details

The command will compute the difference of x and y and bootstrap the difference. The mean and standard error of the bootstrap distribution will be printed as well as a bootstrap percentile interval.

Observations with missing values are removed.

References

Tim Hesterberg's website https://www.timhesterberg.net/bootstrap-and-resampling

Examples

Run this code

#Bootstrap the mean difference of fat content in vanilla and chocolate ice
#cream. Data are paired becaues ice cream from the same manufacturer will
#have similar content.
Icecream
bootPaired(ChocFat ~ VanillaFat, data = Icecream)
bootPaired(Icecream$VanillaFat, Icecream$ChocFat)

Run the code above in your browser using DataLab