R/powerTrans.R

Defines functions powerTrans

Documented in powerTrans

#' Power Transformations
#'
#' @param x numeric vector of data
#' @param lambda numeric value
#'
#' @return numeric vector, transformed according to Box-Cox family of power transformations (equation 4-34 from JW)
#' @export
#'
#' @examples powerTrans(rnorm(50), 2)
powerTrans <- function(x, lambda){
  if(lambda==0){
    log(x)
  } else{
    (x^lambda - 1)/lambda
  }
}
yut4916/MATH5793YUT documentation built on Dec. 23, 2021, 8:21 p.m.