two_mean_bootstrap_CI: Bootstrap confidence interval for a difference in means

View source: R/s216-applets.R

two_mean_bootstrap_CIR Documentation

Bootstrap confidence interval for a difference in means

Description

This function will create a bootstrap confidence interval for a difference in means or difference in medians of a quantitative variable for two independent groups.

Usage

two_mean_bootstrap_CI(
  formula,
  data,
  summary_measure = "mean",
  first_in_subtraction,
  confidence_level = 0.95,
  number_repetitions = 100
)

Arguments

formula

Formula of the form response ~ predictor, where predictor defines the two groups of the explanatory variable and response is a quantitative response variable.

data

Data frame with columns for response and predictor variables.

summary_measure

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

first_in_subtraction

Value of predictor variable that should be first in order of subtraction for computing difference in means.

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

data(pt)
two_mean_bootstrap_CI(responses ~ brand,
  data = pt,
  first_in_subtraction = "B1",
  confidence_level = 0.98,
  number_repetitions = 1000
)

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