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

◆ prob_constrain() [2/3]

template<typename T >
T stan::math::prob_constrain ( const T &  x,
T &  lp 
)
inline

Return a probability value constrained to fall between 0 and 1 (inclusive) for the specified free scalar and increment the specified log probability reference with the log absolute Jacobian determinant of the transform.

The transform is as defined for prob_constrain(T). The log absolute Jacobian determinant is

The log absolute Jacobian determinant is

\(\log | \frac{d}{dx} \mbox{logit}^{-1}(x) |\)

\(\log ((\mbox{logit}^{-1}(x)) (1 - \mbox{logit}^{-1}(x))\)

\(\log (\mbox{logit}^{-1}(x)) + \log (1 - \mbox{logit}^{-1}(x))\).

Template Parameters
Ttype of scalar
Parameters
[in]xunconstrained value
[in,out]lplog density
Returns
result constrained to fall in (0, 1)

Definition at line 51 of file prob_constrain.hpp.