I am trying to write a Winbugs/Jags model for modeling multi grain topic models (exactly this paper -> http://www.ryanmcd.com/papers/mg_lda.pdf)
Here I would like to choose a different distribution based on a particular value. For Eg: I would like to do something like
`if ( X[i] > 0.5 )
{
Z[i] ~ dcat(theta-gl[D[i], 1:K-gl])
W[i] ~ dcat(phi-gl[z[i], 1:V])
}
else
{
Z[i] ~ dcat(theta-loc[D[i], 1:K-loc])
W[i] ~ dcat(phi-loc[z[i], 1:V])
}
`
Is this possible to be done in Winbugs/JAGS?
Winbugs/JAGS is not a procedural language, so you cannot use the construct like that. Use
step
function. Quote from the manual:So you need a trick to change the condition:
and then use this for indexing trick: