Solved – Define Priors for Dirichlet Distribution parameters in JAGS

hierarchical-bayesianjagsopen-bugswinbugs

I'm defining a Multinomial-Dirichlet model in JAGS and want to assign some hyperpriors to the parameters of the Dirichlet distribution. In the WinBugs manual I read that "the parameters of Dirichlet and Wishart distributions and the order (N) of the multinomial distribution must be specified and cannot be given prior distributions. (There is, however, a trick to avoid this constraint for the Dirichlet distribution). What's this trick?

Best Answer

I don't know for sure what the trick is, but this is my guess. Using JAGS syntax to specify $\xi \sim \mathcal D(\alpha)$, you would normally do something like this:

xi ~ dirichlet(alpha[])

JAGS would then not allow you to assign a prior to $\alpha = (\alpha_1, \ldots, \alpha_J)$. Instead, let $\xi^\star_j \sim \mbox{Gamma}(\alpha_j, 1)$. Then it can be shown that $$ \xi \equiv \left(\frac{\xi^\star_1}{\sum_j \xi^\star_j}, \ldots, \frac{\xi^\star_J}{\sum_j \xi^\star_j}\right) \sim \mathcal D(\alpha_1, \ldots, \alpha_J). $$

Hence you can do the following:

for(j in 1:J) {
  xi_raw[j] ~ dgamma(alpha[j], 1)
}
for(j in 1:J) {
  xi[j] <- xi_raw[j] / sum(xi_raw[])
}
## Some prior for alpha follows...