R/boot_f_lm.R

Defines functions boot_f_lm

Documented in boot_f_lm

#' boot_f_lm
#'
#' Generate R bootstrap replicates of a lm function applied to data.
#'
#' @param data data frame with variables for model fitting
#' @param index indices to be used for calculation
#' @param lm.formula object of class formula to be passed into lm function
#'
#' @return A matrix with bootstrapped estimates of r squared and adjusted r squared
#'
#' @references https://www.datacamp.com/community/tutorials/bootstrap-r
#' @keywords internal
#'

boot_f_lm <- function(data, index, lm.formula) {
  bsFit <- lm(lm.formula, data=data[index,])
  c(
    summary(bsFit)$r.squared,
    summary(bsFit)$adj.r.squared
  )
}

Try the dendroTools package in your browser

Any scripts or data that you put into this service are public.

dendroTools documentation built on July 26, 2023, 5:12 p.m.