model { for( i in 1 : nareas) { # Poisson likelihood for observed counts oss[i]~dpois(lambda[i]) lambda[i] <-theta[i,T[i]]*att[i] # Poisson means by group theta[i,1] <- 1 theta[i,2] ~ dgamma(alpha,beta) # group membership T[i] ~ dcat(P[]); #posterior prob of belonging to group 1 or 2 (method 1) Tr[i,1] <- equals(T[i],1) Tr[i,2] <- equals(T[i],2) rr[i]<-Tr[i,1]*theta[i,1]+Tr[i,2]*theta[i,2] } # Prior distributions for "population" parameters alpha ~ dexp(0.1) beta ~ dexp(0.1) #prior on mixture proportions P[1:2]~ ddirch(gamma[]) }