This is an old version, view current version.

10.3 Upper Bounded Scalar

Stan uses a negated logarithmic transform for upper bounds.

Upper Bound Transform

If a variable X is declared to have an upper bound b, it is transformed to the unbounded variable Y by

Y=log(bX).

Upper Bound Inverse Transform

The inverse of the upper bound transform converts the unbounded variable Y to the variable X bounded above by b through

X=bexp(Y).

Absolute Derivative of the Upper Bound Inverse Transform

The absolute derivative of the inverse of the upper bound transform is

|ddy(bexp(y))|=exp(y).

Therefore, the density of the unconstrained variable Y is defined in terms of the density of the variable X with an upper bound of b by

pY(y)=pX(bexp(y))exp(y).