Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ logit() [4/8]

double stan::math::logit ( double  u)
inline

Return the log odds of the argument.

The logit function is defined as for \(x \in [0, 1]\) by returning the log odds of \(x\) treated as a probability,

\(\mbox{logit}(x) = \log \left( \frac{x}{1 - x} \right)\).

The inverse to this function is inv_logit.

\[ \mbox{logit}(x) = \begin{cases} \textrm{NaN}& \mbox{if } x < 0 \textrm{ or } x > 1\\ \ln\frac{x}{1-x} & \mbox{if } 0\leq x \leq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{logit}(x)}{\partial x} = \begin{cases} \textrm{NaN}& \mbox{if } x < 0 \textrm{ or } x > 1\\ \frac{1}{x-x^2}& \mbox{if } 0\leq x\leq 1 \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
uargument
Returns
log odds of argument

Definition at line 46 of file logit.hpp.