I want to know if my statement and derivation of the marginalization of the "intermediate" variable is correct. The statement is as follows:
Suppose a probabilistic factorization model $p(x, y, z, w) = p(x)p(y)p(w|x, y)p(z|x,y)$ . Then the following relation holds: $p(w|z, y) = \int_z p(w| x, z)p(z| x, y)dz$.
The derivation of the above statement is as follows. Thanks to the factorization model we have $$p(z, w|x, y) = \frac{p(z, w, x, y)}{p(x, y)} = \frac{p(x)p(y)p(w|x, y)p(z|x, y)}{p(x)p(y)}=p(w|x, y)p(z|x, y).$$ Therefore, due to the sum rule we have $$ p(w|z, y) = \int_z p(z, w| x, y)dz = \int_z p(w| x, z)p(z| x, y)dz.$$