# EM Algorithm for Poisson Gamma

I would like to check if I have done this question right. I am trying to derive the EM algorithm for $$\mu$$ in the following distributions: $$f(Y|Z) = \frac{z^y}{y!} e^{-z}$$ $$f(Z) = \frac{\theta^\theta}{\Gamma(\theta)} z^{\theta -1} \mu^{-\theta} e^{- \frac{\theta}{\mu} * z}$$

First, from the complete likelihood: $$f(Y,Z) = \frac{z^y}{y!} e^{-z} \frac{\theta^\theta}{\Gamma(\theta)} z^{\theta -1} \mu^{-\theta} e^{- \frac{\theta}{\mu} \times z}$$ We take the log derivitive and get that $$\frac{\ln(f(Y,Z)}{d \mu} = -z + \theta z \mu^{-1} = 0$$ Which gives $$\mu = z$$. This is the M Step of the EM algorithm.

As for the E step, if I understand the algorithm correctly, then our goal is to replace $$Z$$ with $$E(Z|Y)$$.

$$f(Z|Y) = \frac{f(Z,Y)}{f(Y)} = \frac{f(Z,Y)}{\int f(Y,Z) dZ}$$ \begin{align} f(Y) = \int_0^\infty f(Y,Z) dZ &= \int_0^\infty \frac{z^y}{y!} e^{-z} \frac{\theta^\theta}{\Gamma(\theta)} z^{\theta -1} \mu^{-\theta} e^{- \frac{\theta}{\mu} \times z} dz\\ &= \frac{\theta}{\Gamma(\theta)} \mu^{-\theta} \frac{1}{y!} \int_0^\infty z^{y +\theta -1} e^{-(1 + \frac{\theta}{\mu})z} dz\\ &= \frac{\theta}{\Gamma(\theta)} \mu^{-\theta} \frac{1}{y!} \frac{\Gamma(y + \theta)}{(1 + \frac{\theta}{\mu})^{y + \theta}}\\ &= \frac{\theta}{\Gamma(\theta)} \mu^{-\theta} \frac{1}{y!} \frac{\Gamma(y + \theta)}{(1 + \frac{\theta}{\mu})^{y + \theta}}\\ \end{align} Using the fact that the inside of the integral is the kernel of the Gamma$$\left( y+\theta,1 + \frac{\theta}{\mu}\right)$$ distribution. $$f(Z|Y) = \frac{f(Z,Y)}{f(Y)}$$ $$f(Z|Y) = \frac{\frac{z^y}{y!} e^{-z} \frac{\theta^\theta}{\Gamma(\theta)} z^{\theta -1} \mu^{-\theta} e^{- \frac{\theta}{\mu} * z}}{\frac{\theta}{\Gamma(\theta)} \mu^{-\theta} \frac{1}{y!} \frac{\Gamma(y + \theta)}{(1 + \frac{\theta}{\mu})^{y + \theta}}}$$ $$= \frac{(1+ \frac{\theta}{\mu})^{y + \theta}}{\Gamma(y + \theta)}z^{y + \theta - 1} e^{-(1 + \frac{\theta}{\mu})z}$$ Which is still the Gamma$$\left( y+\theta,1 + \frac{\theta}{\mu}\right)$$ . And so $$E(Z|Y) = \frac{y + \theta}{1 + \frac{\theta}{\mu}}$$ This is our E-step.

Is this correct? I am especially wondering if I am understanding the EM algorithm and this is the correct equations to solve.

• Yes, this sounds correct. Apr 28, 2019 at 19:22

I'm getting the derivative of the log of the joint density as $$-\frac{\theta}{\mu}+\frac{\theta z}{\mu^2}=0,$$ which then simplifies to $$-1+\frac{z}{\mu}=0,$$ so $$\mu=z.$$ This makes intuitive sense since Poissons and Gammas are both positive.