E-step in EM algorithm with non trivial latent variables I am trying to derive the E-step for an EM algorithm for this model:

The interesting fact is that there are two sets of latent variables: $z$ and $y$. The E-step involve a derivation of the posterior on the latent variables given the fixed parameters ($\mu$).
During the derivation of the probabilities of the $y$'s I marginalize over $z$ given $\tau$. I wonder: if before this computation I already have computed the $\mu$ for $z$, can I use these computed probabilities instead of marginalizing over $\tau$?
Here is the current result of my derivations:
$$
\mu(z) \propto p(z|\tau)\sum_\mathbf{y}\prod_j^M p(x_j|\phi,y_j) p(y_j|\theta,z)\\
\mu(y_j) \propto \sum_z p(x_j|\phi)p(y_j|\theta,z)p(z|\tau)
$$
So the question can be rephrased as: in the derivation of $\mu(y_j)$, can
I replace $p(z|\tau)$ with $\mu(z)$ ?
 A: When solving the E step in EM, you have to compute
$$Q(\theta,\theta')=\mathbb{E}_\theta[\log L(\theta'|x,Y,Z) | X]$$
which can be decomposed as
$$\mathbb{E}_\theta[\mathbb{E}_\theta[\{\log L(\theta'|x,Y,Z)|X,Z\} | X]$$
and as
$$\mathbb{E}_\theta[\mathbb{E}_\theta[\{\log L(\theta'|x,Y,Z)|X,Y\} | X]$$
where $L(\theta'|x,y,z)$ denotes the complete likelihood,
meaning that the inner integral is for the conditional distribution of the latent given the other latent and the outer one is for the marginal distribution of the other latent.
Since in your case this complete likelihood write as
$$L(\theta|x,y,z)=p(z|\tau)\prod_j^M p(x_j|\phi,y_j) p(y_j|\zeta,z)$$
you get that
$$\log L(\theta|x,y,z)=\log p(z|\tau)+\sum_j^M \{\log p(x_j|\phi,y_j) +\log p(y_j|\zeta,z)\}$$
and hence
$$Q(\theta,\theta')=\mathbb{E}_\theta\left[\mathbb{E}_\theta\left[
\log p(z|\tau')+\sum_j^M \{\log p(x_j|\phi',y_j) +\log p(y_j|\zeta',z)\}\Big|Z,x\right]\Big|x\right]\\=\mathbb{E}_\theta\left[\log p(z|\tau')|x\right]+\sum_j^M\mathbb{E}_\theta\left[\mathbb{E}_\theta\left[\log p(x_j|\phi',y_j) +\log p(y_j|\zeta',z)\}\Big|Z,x\right]\Big|x\right]$$
where the first expectation only depends on the marginal of $Z$ given $X=x$.
