Is it possible to do Expectation maximization for a Gamma mixture model?

loveslave used Ask the Experts™
I have an array of 1-dimensional data that I'd like to fit a Gamma mixture model two. The data is drawn from two Gamma distributions. I've implemented EM for Gamma distributions, and it works as long as I only fit one distribution to the data.

However, when I try to fit two distributions, the algorithm converges to a solution with one distribution with weight 1 (sort-of fitting to all of the data) and one distribution with weight 0. This happens even when I supply initial parameters that I found by fitting a Gamma function to each part of the data in isolation, and even when I artificially add "space" between the two underlying distributions, so that they are well-separated.

I thought that it would be easy to find ready-made implementations of EM for different kinds of PDFs, but it seems that all packages I've found are for Gaussian distributions only. And since my own implementation doesn't give the expected result either, I ask:

Is it possible to do Expectation Maximization to find the parameters of a mixture of Gamma distributions?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


I'll try to rephrase the question. Unfortunately it seems very difficult to typeset math in this forum, so I'll just refer to the Wikipedia Gamma dsitribution article at

Assuming that it is possible to use EM for a Gamma mixture model, I'm not sure if I'm doing the maximum likelihood update of the parameters correctly.

I'm using the heuristic update from the Wikipedia page on Gamma distributions for the k parameter, but instead of the scale factor 1/N, I use 1/Sum(y(i,j)), where Sum(y(i,j)) is the sum of all partial membership values. And when computing the parameter s, I use the x parameters weighted by their corresponding partial membership value.

Is this correct?
Most Valuable Expert 2014
Top Expert 2015

How did you compute the expectation that yp0u maximized?


Sorry for my delay. I just had a prematurely born baby, and I won't have time for work in a few days. Please don't close the question. I'll be back later.
I found the error. It was the fault of my implementation. (I was using the partial membership weighting inside the ln function instead of outside, when computing the ML parameter estimates.)

Thanks a lot for your effort.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial