R/logit_prob.R

Defines functions logit_prob

Documented in logit_prob

#' Convert Logit to Probability
#' 
#' Defined as: \code{exp_x <- exp(x); out <- exp_x / (1 + exp_x)}. This 2-step 
#' approach is faster than \code{exp(x) / (1 + exp(x))} because the exponentials 
#' only have to be calculated once.
#' 
#' @param x Numeric vector.
#' 
#' @return Numeric vector.
#' 
#' @export
logit_prob <- function(x) {
  exp_x <- exp(x)
  out <- exp_x / (1 + exp_x)
  return(out)
}

Try the dvmisc package in your browser

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

dvmisc documentation built on May 2, 2019, 5:51 p.m.