logit: Generalized logit and inverse logit function

Description Usage Arguments Details Value Author(s) Examples

View source: R/logit.R

Description

Compute generalized logit and generalized inverse logit functions.

Usage

1
2
logit(x, min = 0, max = 1)
inv.logit(x, min = 0, max = 1)

Arguments

x

value(s) to be transformed

min

Lower end of logit interval

max

Upper end of logit interval

Details

The generalized logit function takes values on [min, max] and transforms them to span [-Inf,Inf] it is defined as:

y = log(p/(1-p))

where

p=(x-min)/(max-min)

The generized inverse logit function provides the inverse transformation:

x = p * (max-min) + min

where

exp(y)/(1+exp(y))

Value

Transformed value(s).

Author(s)

Gregory R. Warnes <greg@warnes.net>

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
  x <- seq(0,10, by=0.25)
  xt <- logit(x, min=0, max=10)
  cbind(x,xt)

  y <- inv.logit(xt, min=0, max=10)
  cbind(x,xt,y)  

## End(Not run)

phcfM documentation built on May 30, 2017, 5:21 a.m.