They should still return the same value though.

One takes sigma^2 as an argument; it replaces all instances of sigma^2 with your sigma^2.

The other takes sigma as an argument; it replaces all instances of sigma with your sigma.

The function is the same, and it will return the same value. It’s just that you should sample sigma instead of sigma^2. It’s not a bug, they just set the arguments in terms of sigma, rather than sigma^2.

Like, if you had f(y) = y^2 + y, and another g(y^2) = y^2 + y, you’d get the same output. All that matters is in the programming of it: f(a) = a^2 + a; g(b) = b + sqrt(b). You’d still get the same answer, no? It just matters whether you think in terms of ‘y’ or ‘y^2’. The output winds up being the same. So if you sampled just sigma, and used the scaled inv. chi-squared using the arguments that stan uses, you’d get the same answer that you would if you sampled sigma^2, and used a version that assumes the input is a sigma^2.

With that said - you don’t *have* to worry about conjugacy with Stan anyway; I wasn’t aware that people still use scaled inverse chi-squared over, say, a half-t or half-normal or anything else that is easier to reason about.