R/fexpit.R

Defines functions fexpit

Documented in fexpit

#' Calculate expanded expit function
#'
#' Helper function for calculating expanded expit
#'
#' @param x    A vector of values between -Inf and +Inf
#' @param sqz  The amount by which to 'squeeze' (DEFAULT: 0.000001)
#'
#' @return     A vector of values between 0 and 1 inclusive
#'
#' @importFrom gtools inv.logit
#'
fexpit <- function(x,
                   sqz = 0.000001) {
  tmp <- (gtools::inv.logit(x) * 2) - 1
  tmp <- (tmp / (1 - sqz)) + 1
  tmp <- tmp / 2
  return(tmp)

# Original code
# ((((inv.logit(x) * 2) - 1) / (1 - sqz)) + 1) / 2
}

Try the biscuiteer package in your browser

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

biscuiteer documentation built on Nov. 8, 2020, 8:28 p.m.