I have a model which includes two exponential rate parameters. I would like to test whether a model with two individual rates describes some data better than a model for which both rates are the same. I think I could just estimate the model with two parameters and look at HDI around the difference. However, later I would like to compare more complex (an possibly not-nested) similar models. So I would like to use this as a toy example and calculate Bayes-Factors in JAGS.

Therefore, I would like to set up two models. One in which both rate parameters are drawn from the same normal distribution. And the other where they are drawn from independent normal distributions.

I'm unsure about the choice of priors, however. Do they need to be conjugate for the Bayes-Factors to be proper? (I suspect: Even if not in this toy example, when I use more complex models with different parameters they may have to be conjugate?).

How could I specify such conjugate priors (normal; unknown mean & unknown variance, I guess) for the rate parameters in JAGS?

Details and additional questions regarding the priors:

The model is as follows:

$y_i \sim B(N_i, p_i)$

$p_i $<- some_equation_with_two_exp_rate($v_1,v_2,i$)

Now I would like to specify different versions: One where both rates are equal ($v_1=v_2$) [and others, e.g., one that expresses $v_1>v_2$].

So first, for specifying the equality I was thinking of setting $v_1$ <- $x$ and $v2$ <- $x$ and $x$ ~ some_prior_dist. However, I think that wouldn't be correct, because the $v$'s represent two independent processes (with the same rate). So I tried adding hyperprior: $v_1$ ~ some_prior_dist($x,var$) and $v_2$ ~ some_prior_dist($x,var$) and $x$ ~ some_hyper_prior_dist($m,var2$).

For the distributions I mainly tried dnorm. Estimations seems strange: while I still get reasonable posteriors for the $v_1$ and $v_2$, m yields strange estimates (very broad distributions, as if not sufficiently constrained by the data). Furthermore, I'm unsure about which variances ($var,var2$ in the dummies above) to fix and which should get individual priors. Any hints?

Many thanks, Jan


2 Answers 2


Actually, you do not need to specify conjugate priors for sampling. In fact, conjugate priors make estimation faster for Gibbs sampler, but do not change anything for some other samplers. BUGS/JAGS choose "best" approach for sampling given your model specification, so if you define a conjugate prior they know how to sample using them. On another hand, algorithms used in Stan do not profit from conjugate priors so there is no point in using them.

As for conjugate priors, you can find a nice cheat sheets in two papers by Leemis (1986, 2008), paper by Fink (1997), here or here.

Unfortunately I won't help with Bayes Factors.

  • $\begingroup$ Many thanks for the reply. I know conjugate priors are not required for estimation. However, from what I understand using improper priors "scales" the posterior, which won't change certain properties lead to the fact that the posterior is not a proper probability distribution. Hence, only when the compared models are scaled equally (same priors and same parameters) this cancels out. Also thanks for the cheat sheets. I like the relationships graphs! And I think I may need to use an inverse gamma normal prior, but I don't know how to set up such a prior in JAGS and can't find any examples. $\endgroup$ Dec 2, 2014 at 16:24
  • $\begingroup$ But for prior to be proper it doesn't have to be conjugate. Also, even improper priors could lead to proper posterior, e.g. stats.stackexchange.com/questions/97768/… , so it's not a matter of conjugate priors. $\endgroup$
    – Tim
    Dec 2, 2014 at 16:39
  • $\begingroup$ Thanks, I didn't know that. So maye can I simply check whether the posterior integrates to 1. $\endgroup$ Dec 2, 2014 at 21:18
  • $\begingroup$ I'm still having trouble with setting up the priors to specify that two rate I have are equal. I extended the original question with details. $\endgroup$ Dec 4, 2014 at 14:41

Tim is correct that conjugate priors aren't required - they will alter the sampler that BUGS/JAGS chooses to use, which may alter the speed of the model, but otherwise it should make no difference.

Using a proper prior is a good idea. If the prior is proper (not necessarily conjugate - just any distribution that integrates to 1), the posterior will be proper, which is a good thing. If the prior is improper, the posterior may still be proper - but this is not guaranteed so you have to be more careful. A diffuse gamma prior would be common to use as a minimally informative prior for rate parameters (depending on the application), but I would compare results to using DuMouchel's prior (a special case of the Lomax distribution) to make sure the prior is not being more informative than you think - these are implemented for JAGS in the runjags R package (http://cran.r-project.org/web/packages/runjags/vignettes/runjags.pdf). If the two priors give the same inference, you are almost certainly making data-dominated inference.

In terms of model selection - Bayes factors are one approach, but DIC (deviance information criterion) will be much more straightforward to calculate and is implemented directly in JAGS and BUGS. Is there a particular reason you want to use Bayes factors rather than DIC?

  • $\begingroup$ I agree that Bayes Factors are not the best method for model comparison (e.g. andrewgelman.com/2009/02/26/why_i_dont_like), however one have to remember that DIC is also not perfect (e.g. andrewgelman.com/2011/06/22/deviance_dic_ai). $\endgroup$
    – Tim
    Dec 3, 2014 at 11:44
  • $\begingroup$ In the past I used BICs and AICs, but they only give a ranking of the models. I'm interested how much more probable one model is than the others. Therfore I wanted to estimate Bayes Factors. I haven't heard of DICs, but I'll look it up. Thanks for the hints. $\endgroup$ Dec 3, 2014 at 23:40
  • $\begingroup$ I'm still a bit stuck with my priors. I think I need to describe some details: $y_i \sim B(N_i, p_i)$ $\endgroup$ Dec 4, 2014 at 14:17
  • $\begingroup$ I added the details to the original question. $\endgroup$ Dec 4, 2014 at 23:39

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.