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}. \]