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 = \mu + \sigma * X. \]

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 = \frac{Y-\mu}{\sigma}. \]

10.5.1 Absolute Derivative of the Affine Inverse Transform

The absolute derivative of the affine inverse transform is

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

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

\[ p_Y(y) = p_X \! \left( \frac{y-\mu}{\sigma} \right) \cdot \frac{1}{\sigma}. \]