regression_bootstrap_CI: Bootstrap confidence interval for regression

View source: R/s216-applets.R

regression_bootstrap_CIR Documentation

Bootstrap confidence interval for regression

Description

This function will create a bootstrap confidence interval for a slope of simple linear regression or correlation between two quantitative variables.

Usage

regression_bootstrap_CI(
  formula,
  data,
  summary_measure = c("slope", "correlation"),
  confidence_level = 0.95,
  number_repetitions = 100
)

Arguments

formula

Formula of the form response ~ predictor, where predictor defines a quantitative 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 "slope" for confidence interval for slope or "correlation" for confidence interval for correlation.

confidence_level

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

number_repetitions

Number of bootstrapped resamples.

Examples

data(mtfires)
mtfires$logHect <- log(mtfires$Hectares)
regression_bootstrap_CI(logHect ~ Temperature,
  data = mtfires,
  summary_measure = "correlation",
  confidence_level = 0.9,
  number_repetitions = 1000
)

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