expit: Expit and Logit.

Description Usage Arguments Details Value Warning Author(s) Examples

View source: R/expit.R

Description

Functions to take the expit and logit of numerical vectors.

Usage

1
expit(x)

Arguments

x

vector of real numbers; for logit to return a sensible value these should be between 0 and 1.

Details

logit implements the usual logit function, which is

logit(x) = log(x/(1-x)),

and expit its inverse:

expit(x) = e^x/(1+e^x).

It is assumed that logit(0) = -Inf and logit(1) = Inf, and correspondingly for expit.

Value

A real vector corresponding to the expits or logits of x

Warning

Choosing very large (positive or negative) values to apply to expit may result in inaccurate inversion (see example below).

Author(s)

Robin Evans

Examples

1
2
3
4
5
6
x = c(5, -2, 0.1)
y = expit(x)
logit(y)

# Beware large values!
logit(expit(100))

rje42/rje documentation built on Aug. 15, 2017, 7:43 a.m.

Related to expit in rje42/rje...