logit: logit and inverse logit functions

Description Usage Arguments Details See Also Examples

View source: R/RcppExports.R

Description

transform x either via the logit, or inverse logit.

Usage

1
2
3
4
5

Arguments

x

a numeric vector

Details

The loogit and inverse logit functions are part of R via the logistic distribution functions in the stats package. Quoting from the documentation for the logistic distribution

"qlogis(p) is the same as the logit function, logit(p) = log(p/1-p), and plogis(x) has consequently been called the 'inverse logit'."

See the examples for benchmarking these functions. The logit and invlogit functions are faster than the qlogis and plogis functions.

See Also

qlogis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(qwraps2)
library(rbenchmark)

# compare logit to qlogis
p <- runif(1e5)
identical(logit(p), qlogis(p))
benchmark(logit(p), qlogis(p))

# compare invlogit to plogis
x <- runif(1e5, -1000, 1000)
identical(invlogit(x), plogis(x))
benchmark(invlogit(x), plogis(x))

linogaliana/gravity documentation built on April 24, 2020, 2:06 a.m.