R/estimateLimitsOfAgreement.R

Defines functions estimateLimitsOfAgreement

Documented in estimateLimitsOfAgreement

#' Estimate Bland-Altman limits of agreement
#'
#' @param mu mean of the pairwise differences
#' @param SD standard deviation of the pairwise differences
#' @param gamma alpha level for calculating limits of agreement
#' @return a list
estimateLimitsOfAgreement <- function(mu, SD, gamma = 0.05){

  # compute limits of agreement
  zgamma = stats::qnorm(1 - gamma/2, lower.tail = TRUE)
  upperLOA = mu + zgamma * SD
  lowerLOA = mu - zgamma * SD

  result <- list(mu = mu,
       SD = SD,
       gamma = gamma,
       zgamma = zgamma,
       upperLOA = upperLOA,
       lowerLOA = lowerLOA)

  class(result) <- "LOA"
  return(result)
}
nwisn/blandPower documentation built on Jan. 27, 2024, 4:33 a.m.