Stan Math Library
5.0.0
Automatic Differentiation
|
|
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} \]
u | argument |
u | argument |