Joseph Retzer - 2014-03-16

I'm using JAGS/rjags(3.3.0) for a Bayesian finite mixture and in so doing, trying to generate a multinomial with dirichlet priors. I receive the following error:

Error in jags.model(textConnection(coclust.jags), data =, n.chains = 3, :
Error in node rtemp[6,225,1:2]
Unable to find appropriate sampler

(though the error occurs at various i,j positions, e.g. not always 6,225)

I've seen some examples where dmulti was replaced with a dsum of dpois variables but have not had success in implementing that solution. Any advice would be appreciated.

coclust.jags <-
for(i in 1:N){ # likelihood
for(j in 1:D){
x[i,j] ~ dbern(theta[rclass[i,j], cclass[i,j]])
rclass[i,j] <- inprod(rtemp[i,j,1:K], Kexpand[])
rtemp[i,j,1:K] ~ dmulti(pi[i,1:K],1)
cclass[i,j] <- inprod(ctemp[i,j,1:L], Lexpand[])
ctemp[i,j,1:L] ~ dmulti(pj[j,1:L],1)

for(k in 1:K){                            # prior on theta 
  for(l in 1:L){
    theta[k,l] ~ dbeta(1, 1)             

for(i in 1:N) {                           # prior on rows
  pi[i,1:K] ~ ddirich(alpha1[1:K]+.001)   # class prob pi

for(j in 1:D) {                           # prior on columns   
  pj[j,1:L] ~ ddirich(alpha2[1:L]+.001)