Learn R Programming

RBesT (version 1.8-2)

lodds: Logit (log-odds) and inverse-logit function.

Description

Calculates the logit (log-odds) and inverse-logit.

Usage

logit(mu)

inv_logit(eta)

Value

A numeric object of the same type as mu and eta containing the logits or inverse logit of the input values. The logit and inverse transformation equates to

$$\text{logit}(\mu) = \log(\mu/(1-\mu))$$

$$\text{logit}^{-1}(\eta)= \exp(\eta)/(1 + \exp(\eta)).$$

Arguments

mu

A numeric object with probabilies, with values in the in the range \([0,1]\). Missing values (NAs) are allowed.

eta

A numeric object with log-odds values, with values in the range \([-\infty,\infty]\). Missing values (NAs) are allowed.

Details

Values of mu equal to 0 or 1 will return \(-\infty\) or \(\infty\) respectively.

Examples

Run this code
logit(0.2)
inv_logit(-1.386)

Run the code above in your browser using DataLab