Logit and inverse logit functions

logit(x)

ilogit(x)

Arguments

x

a numeric vector

Value

For logit the value is $$log(x/(1 - x))$$

For ilogit the value is $$exp(x)/(1 + exp(x))$$

Examples

p <- seq(.1, .9, by=.10)
l <- logit(p); l
#> [1] -2.1972246 -1.3862944 -0.8472979 -0.4054651  0.0000000  0.4054651  0.8472979
#> [8]  1.3862944  2.1972246
ilogit(l)
#> [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
ilogit(l) == p
#> [1] FALSE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE