R/transformations.R

Defines functions glogit

Documented in glogit

#' logit transformation
#'
#' @param x variable name
#' @param a lower boundary for transformation
#' @param b upper boundary for transformation
#' @return a vector of logit transformed feature values
#' @export
glogit <- function(x, a, b){
  epsilon <- 1e-6
  x[x < a + epsilon] <- a + epsilon
  x[x > b - epsilon] <- b - epsilon
  p <- (x - a)/(b - a)
  return(log(p/(1-p)))
}
thiyangt/fformpp documentation built on Jan. 5, 2024, 5:44 a.m.