Learn R Programming

geostats (version 1.6)

logit: logistic transformation

Description

Maps numbers from [0,1] to [\(-\infty,+\infty\)] and back.

Usage

logit(x, ...)

# S3 method for default logit(x, inverse = FALSE, ...)

# S3 method for density logit(x, inverse = TRUE, ...)

Value

a vector with the same length of x

Arguments

x

a vector of real numbers (strictly positive if inverse=FALSE) or an object of class density.

...

optional arguments to the log function.

inverse

logical. If inverse=FALSE, returns \(\ln\!\left[\frac{x}{1-x}\right]\); otherwise returns \(\frac{\exp[x]}{\exp[x]+1}\).

Examples

Run this code
data(catchments,package='geostats')
lp <- logit(catchments$vegetation/100,inverse=FALSE)
ld <- density(lp)
d <- logit(ld,inverse=TRUE)
plot(d)

Run the code above in your browser using DataLab