Question about a mixture dirichlet MCMC model I am self-learning Bayesian statistics using the book Computational Bayesian Statistics by Turkman et al. and I am currently stuck on Chapter 6 Problem 10. It can be found here on page 124.
I am confused about the introduction of latent variables. I'm not sure how to write the full joint probability model in part (a) under the change of variables for the $\pi$. What's throwing me off specifically are the $q$ and $r$. Is the full joint
\begin{align*}p(\pi^*, q, r, z, y) &\propto p(y \mid \pi^*, q, r, z)p(q, r \mid z)p(\pi^*)p(z) \\ &\propto {(\pi^*)}^{\sum_{j=1}^{M_1} y_j} (1-\pi^*)^{\sum_{j=M_1 + 1}^{N} y_j} \prod_{j=1}^{M_1} q_j^{y_j} \prod_{j=M_1+1}^N r_j^{y_j} \cdot \prod_{j = 1}^{M_1} q_j^{a_1 - 1} \prod_{j = M_1 + 1}^{N} r_j^{a_0 - 1} \\ &\cdot \frac{1}{B(a^*, b^*)} (\pi^*)^{a^* - 1}(1 - \pi^*)^{b^* - 1} \cdot \rho^{z} (1 - \rho)^{1 - z}?\end{align*}
In part (c), I am stuck on calculating the conditional posterior for $z_j$ and $q, r$. Would it make sense to just evaluate the joint at $z_j = 1$ and $z_j = 0$? I realize that there is a factor to consider in $p(\tilde q) = Dir(\tilde q \mid a_z,\ldots,a_z)$ for $z_j = z$. I know the $\tilde q$ don't directly involve the $z_j$ though, but there is an implicit dependence.
I am also stuck on part (g) - how would I compute an appropriate acceptance probability for the Metropolis-Hastings scheme? Any help with this problem would be appreciated!

Not a full answer but a few comments that might help:

*

*The probability you wrote is $p(y|\pi^*,q,r,z)$, the full joint probability should include the priors $p(y,\pi^*,q,r,z) = p(y|\pi^*,q,r,z)p(q,r|z)p(\pi^*)p(z)$

*For the conditional distribution $h(z_j|...)$ it might help to explicitly include the dependence on the $z_j$'s. Note that you can express $\pi_j$ as   $\pi_j = (\pi^* q_j)^{z_j}((1-\pi^*)r_j)^{1-z_j}$, which will allow you to calculate :

$$ h(z_j|...) = \frac{p(y,\pi^*,q,r,z)}{\rho p(y,\pi^*,q,r,z_j=1,z_{-j}) + (1-\rho)p(y,\pi^*,q,r,z_j=0,z_{-j})}$$
