This is an old version, view current version.

10.2 Lower bounded scalar

Stan uses a logarithmic transform for lower and upper bounds.

Lower bound transform

If a variable \(X\) is declared to have lower bound \(a\), it is transformed to an unbounded variable \(Y\), where

\[ Y = \log(X - a). \]

Lower bound inverse transform

The inverse of the lower-bound transform maps an unbounded variable \(Y\) to a variable \(X\) that is bounded below by \(a\) by

\[ X = \exp(Y) + a. \]

Absolute derivative of the lower bound inverse transform

The absolute derivative of the inverse transform is

\[ \left| \, \frac{d}{dy} \left( \exp(y) + a \right) \, \right| = \exp(y). \]

Therefore, given the density \(p_X\) of \(X\), the density of \(Y\) is

\[ p_Y(y) = p_X\!\left( \exp(y) + a \right) \cdot \exp(y). \]