Hi, I’m a novice and currently working on a project involving IBP stick-breaking. However, I have encountered an issue where the Bernoulli distribution in the model block requires the int matrix to be in the parameters block. I was wondering if there are any methods that I can utilize to avoid this situation.
Below are the pieces of code that I have written:
v_l \sim beta(\alpha,1),
\theta_{(k)} = \prod_{l=1}^k v_l,
\gamma_{jk}|\theta_{(k)} \sim Bernoulli[\theta_{(k)}].
Where j=1,...,G, k=1,...K.
parameters {
...
vector<lower=0, upper=1>[K] v;
int<lower=0, upper=1> gamma[G,K];
...
}
transformed parameters{
simplex[K] theta;
{
theta[1] = v[1];
for(k in 2:K){
theta[k] = theta[k-1] * v[k];
}
}
}
model {
v ~ beta(alpha, 1);
for(j in 1:G){
for(k in 1:K){
gamma[j,k] ~ bernoulli(theta[k]);
}
}
...
}
Thanks.