Skip to content

Docs for affinely transformed scalar do not match implementation #356

@martinmodrak

Description

@martinmodrak

Summary:

It appears that the transformation in the Affinely transformed scalar section is reversed compared to how it is implemented in Stan math.

Description:

In the documentation, we state that Y = mu + sigma * X where Y is the unconstrained variable as used by Stan and X is what the user sees (at least that's how it is used in the Lower-bounded scalar chapter). However, the implementation (https://github.com/stan-dev/math/blob/92075708b1d1796eb82e3b284cd11e544433518e/stan/math/prim/fun/offset_multiplier_constrain.hpp) and the way it is used suggests that the transformation is inverted, i.e. that Y = (X - mu)/sigma. Consequently the Jacobian in the docs is 1 / sigma while in the code it is sigma.

Additional Information:

Noticed this when inspecting https://discourse.mc-stan.org/t/offset-multiplier-initialization/20712

Current Version:

v2.26.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions