I'm using Jags to fit a Bayesian linear regression to a dataset.

The model is:
with precision τ and mean:

All β coefficients come from N(0,0.001). N[i] is the measurement for each sample. If I know that the instrument I used to measure samples has a SD of 0.2. Is it accurate to model this explicitly by specifying τ as 1/variance?


1 Answer 1


In principle, you can set $\tau = 0.2 ^{-2} = 2500$. This isn't breaking any mathematical rule. Just set $\tau = 0.2^{-2}$ in your script somewhere. However, do you know for sure that this is the case? Are you happy to say literally any other value for $\tau$ is impossible? In this is simulated data then that is fine, but in any real data scenario I can rarely (if ever) see this being true.

Perhaps you could set $\tau \sim Gamma(a, b)$ where the median of this distribution is $0.2^{-2}$ and then express your uncertainty by choosing appropriate values of $a$ and $b$ so that you can obtain a posterior distribution for the precision, $\tau | x$, in a similar way that your current method will obtain a joint posterior distribution for your regression coefficients.

  • $\begingroup$ In this case, the SD of the measurement is calculated for the instrument and so is a discrete value. But I hear what you are saying. Is there a way to set the median for a gamma distribution? Perhaps I could just set the SD as coming from dnorm(0.2,0.001) to allow that uncertainty and pull τ from that. $\endgroup$
    – Sovay
    Jun 17, 2020 at 19:24
  • $\begingroup$ You should set the sd (or variance or precision) to be strictly positive. You could instead set log(sd)~normal( log(0.2), v) where v is chosen to represent your uncertainty about the sd appropriately. $\endgroup$
    – jcken
    Jun 17, 2020 at 20:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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