logit: Logit function

View source: R/logit.R

logitR Documentation

Logit function

Description

logit computes values transformed by the logit or log-odds function. inv.logit is the inverse of logit. The logarithm base used can be defined (default is natural logarithm). The left and right bounds of the logit function can also be defined, with the default domain being (0, 1).

Usage

logit(x, base = exp(1), left = 0, right = 1, suppress.nan = TRUE)

inv.logit(x, base = exp(1), left = 0, right = 1)

Arguments

x

A numeric vector.

base

The base used for the logarithm.

left, right

The lower and upper domain boundaries of the corresponding logit function. Defaults are 0 and 1.

suppress.nan

Whether to output NaN or -Inf/Inf when x is out of bounds. If TRUE, an out-of-bounds warning is issued while suppressing the NaN into either Inf (x > right) or -Inf (x < left).

Value

A vector with the same length as x.

Examples

logit(0.7)
logit(6.2, left = 0, right = 10)
logit(-0.07, suppress.nan = FALSE)
logit(0.01, base = 10)

inv.logit(2.31)
inv.logit(5.1, left = -1, right = 1)
inv.logit(2, base = 2)


wyppeter/bbum documentation built on Oct. 3, 2023, 3:29 p.m.