one_mean_CI: Bootstrap confidence interval for a single mean

View source: R/s216-applets.R

one_mean_CIR Documentation

Bootstrap confidence interval for a single mean

Description

This function will create a bootstrap confidence interval for a single mean or median of a quantitative variable.

Usage

one_mean_CI(
  data,
  summary_measure = "mean",
  confidence_level = 0.95,
  number_repetitions = 100
)

Arguments

data

Vector of quantitative data values.

summary_measure

Name of summary measure to return from simulations. Allowed values are "mean" or "median". Defaults to "mean".

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)
m <- mean(x)
one_mean_CI(x,
            summary_measure = "mean",
            number_repetitions = 100,
            confidence_level = 0.95
)

greenwood-stat/catstats documentation built on Dec. 14, 2024, 6:25 p.m.