paired_bootstrap_CI: Bootstrap confidence interval for a paired mean difference

View source: R/s216-applets.R

paired_bootstrap_CIR Documentation

Bootstrap confidence interval for a paired mean difference

Description

This function will create a bootstrap confidence interval for a paired mean difference or paired median difference between two quantitative variables for matched pairs data.

Usage

paired_bootstrap_CI(
  data,
  summary_measure = "mean",
  which_first = 1,
  confidence_level = 0.95,
  number_repetitions = 100
)

Arguments

data

Vector of differences or a two- or three-column data frame with values for each group in last two columns.

summary_measure

Name of summary measure to return from simulations. Allowed values are "mean" for confidence interval for paired mean difference or "median" for confidence interval for paired median difference. Defaults to "mean".

which_first

Which column is first in order of subtraction? 1 if subtracting second column from first (1 - 2); 2 if subtracting first column from second (2 - 1). Defaults to 1.

confidence_level

Confidence level for interval in decimal form. Defaults to 0.95 (95% confidence interval).

number_repetitions

Number of bootstrapped resamples.

Value

Returns plot of distribution of bootstrapped statistics, with values as or more extreme than percentile confidence interval range highlighted, and reports confidence interval as subtitle on plot.

Examples

set.seed(117)
x <- rnorm(25)
y <- x + 1 + rnorm(25, 0, 1.8)
data <- data.frame(x, y)
paired_bootstrap_CI(data,
  which_first = 1,
  confidence_level = 0.9,
  number_repetitions = 1000
)

greenwood-stat/catstats documentation built on Aug. 1, 2022, 2:04 p.m.