This is an old version, view current version.

10.5 Affinely transformed scalar

Stan uses an affine transform to be able to specify parameters with a given offset and multiplier.

Affine transform

For variables with expected offset \(\mu\) and/or (positive) multiplier \(\sigma\), Stan uses an affine transform. Such a variable \(X\) is transformed to a new variable \(Y\), where

\[ Y = \frac{X - \mu}{\sigma}. \]

The default value for the offset \(\mu\) is \(0\) and for the multiplier \(\sigma\) is \(1\) in case not both are specified.

Affine inverse transform

The inverse of this transform is

\[ X = \mu + \sigma \cdot Y. \]

10.5.1 Absolute derivative of the affine inverse transform

The absolute derivative of the affine inverse transform is

\[ \left| \frac{d}{dy} \left( \mu + \sigma \cdot y \right) \right| = \sigma. \]

Therefore, the density of the transformed variable \(Y\) is

\[ p_Y(y) = p_X \! \left( \mu + \sigma \cdot y \right) \cdot \sigma. \]