R/logit.R

# $Id: logit.R 625 2005-06-09 14:20:30Z nj7w $

logit <- function(x, min=0, max=1)
  {
    p <- (x-min)/(max-min)
    log(p/(1-p))
  }

inv.logit <- function(x, min=0, max=1)
  {
    p <- exp(x)/(1+exp(x))
    p <- ifelse( is.na(p) & !is.na(x), 1, p ) # fix problems with +Inf
    p * (max-min) + min
  }
                 

Try the gtools package in your browser

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

gtools documentation built on May 2, 2019, 4:52 p.m.