R/calculate_se.R

Defines functions calculate_se

Documented in calculate_se

#' Function to calculate SE for between and within designs
#' 
#' description
#' 
#' @param sd1 numeric.
#' @param sd2 numeric.
#' @param n integer.
#' 
#' @return The function returns...
#' 
#' @export
calculate_se <- function(sd1, sd2 = NULL, n) {
  # Validating arguments ---------------------------
  #sd1 must be something
  
  if (is.null(sd2)) {
    sd1 / sqrt(n)
  } else {
    sqrt(((n - 1) * sd1 ^ 2 + (n - 1) * sd2 ^ 2) / (2 * n - 2)) * sqrt(2 / n)
    }
}
BencePalfi/SampleSizeBF documentation built on April 3, 2025, 2:01 p.m.