bootPaired {CarletonStats}R Documentation

Bootstrap paired data

Description

Perform a bootstrap of two paired variables.

Usage

bootPaired(x, ...)

## Default S3 method:
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 class 'formula'
bootPaired(formula, data, subset, ...)

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.

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.

Value

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

Methods (by class)

Author(s)

Laura Chihara

References

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

Examples


#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)


[Package CarletonStats version 2.2 Index]