In the Bayesian analysis, $\mathtt{rjags}$ in particular, it is very frequent to see the code:

sigma ~ dunif(0, 100)
sigma.1 <- pow(sigma, -2)

But, what does this mean? Is this meaning that $\sigma\sim Unif(0.01, 100)$ and $\sigma_1=\sigma^{-2}$ and we are doing a transformation of the uniform distribution? As I do the transformation, I got the pdf of $\sigma_1$ to be $\frac{y}{50}$ over $(100^{-2}, +\infty)$, which indeed is not a valid density if I did not make any mistake in my calculations.

Any explanations? Thanks!

  • $\begingroup$ Can you give a link to such a code ? $\endgroup$ – peuhp Apr 29 '16 at 14:50
  • $\begingroup$ @peuhp biostat.umn.edu/~brad/data/dugongsNL_BUGS.txt Here is an example. See the model part. $\endgroup$ – user132565 Apr 29 '16 at 14:51
  • 2
    $\begingroup$ You got confused in the change of variable, the Jacobian returns $\sigma_1^{-3/2}$. $\endgroup$ – Xi'an Apr 29 '16 at 14:51

I think you misunderstood the code because of the parametrisation used in Bugs and Jags syntax. In Jags and Bugs, the normal density as well as other location/scale distributions are parametrized such as e.g.


where precision is the precision i.e. by definition $1/\sigma^2$ and generally denoted as $\tau$. So the prior on $\sigma$ is uniform (which has its limits but it is another question see e.g. Weakly informative prior distributions for scale parameters)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.