We calculate a Bayesian model and only expect positive values for our parameters. Our prior is however a uniform prior—we get negative samples from MCMC.

For Bayes-factor calculations we use the Savage-Dickey density ratio. In order to account for the restriction to positive values, we normalize the positive area of prior and posterior distribution so they each have an area of one and calculate the density ratio.

Question: what does this mean for our credible interval? At the moment we use the interval calculated by JAGS. But JAGS doesn't know about our restriction.

I suppose the credible interval changes when discarding all negative samples? How should we calculate the correct credible interval? Thanks a lot!

  • 3
    $\begingroup$ Just wondering, why not then put a uniform prior on the range (0, infinity) rather than on (-infinity, infinity)? $\endgroup$ Feb 8, 2014 at 19:01
  • $\begingroup$ In essence we are interested in a binomial distribution with a probability parameter theta from 0 to 1. We transform this parameter to probit space so dealing with distributions is easier. A uniform prior for theta from 0 to 1 is easy: a standard normal distribution on probit space. However a prior as you suggest seems more difficult to implement. $\endgroup$ Feb 8, 2014 at 19:11
  • $\begingroup$ So to clarify: We expect participants to achieve at least chance performance. This means that values below .5 for theta can't appear. And on probit space this means, that negative values are to be excluded $\endgroup$ Feb 8, 2014 at 19:30
  • 2
    $\begingroup$ If values for $\theta$ below 0.5 can't appear, this information should be in a prior for $\theta$. I don't know enough about JAGS to give advice on the easiest ways to achieve that though. $\endgroup$
    – Glen_b
    Feb 8, 2014 at 21:32
  • $\begingroup$ @glen @rasmus According to this paper (p. 127) it is possible to restrict after the analysis: In the Bayesian framework, order-restrictions can be implemented in several ways (...). For instance, order-restrictions can be enforced before MCMC sampling, by appropriately constraining the prior distributions, or they can be implemented after the MCMC sampling, by retaining only those MCMC samples that obey the order-restriction (...). It would like to do the latter because it seem easier. $\endgroup$ Feb 8, 2014 at 21:52

1 Answer 1


You can create the credible interval by

  1. taking only those iterations that satisfy your criteria
  2. calculating quantiles from samples of these iterations

In order to do this, you will need to extract the samples from JAGS.

As @Glen_b mentioned, you could also encode this in the prior. In JAGS, you can do

theta ~ dunif(0.5,1)

or, on the probit scale,

theta <- pnorm(logit_theta,0,1)
logit_theta ~ dnorm(0,1)I(0, )

Now, the intervals calculated from JAGS will have the proper truncation.

With all this being said, you may want to allow for the possibility that $\theta$ is negative. You may expect that the participants will achieve at least chance performance, but they may do worse (perhaps they are using external information that is bad).


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.