R/logit.R

Defines functions inv.logit logit

Documented in inv.logit logit

# $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 June 26, 2018, 5:01 p.m.