expit: The expit and logit functions

Description Usage Arguments Details Value Author(s) Examples

View source: R/simulationEngines.R

Description

The expit and logit functions are useful shortcuts when using logistic regression models.

Usage

1
2
3
expit(x)

logit(p)

Arguments

x

a real number

p

a number between 0 and 1, i.e. a probability

Details

The logit function is defined as logit(p) = log(p)/log(1-p) and can also be described as the log odds of a given probability. The expit is the inverse of the logit function and is defined as expit(x) = exp(x)/(1+exp(x)).

Value

A numeric value, possibly vectorized, depending on the input.

Author(s)

Nicholas G. Reich

Examples

1
2
3
4
5
6
 
expit(-2)
curve(expit(x), from=-5, to=5)

logit(.5)
curve(logit(x), from=0, to=1)

clusterPower documentation built on Sept. 5, 2017, 9:06 a.m.