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

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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

loveslaveAuthor Commented:
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?
How did you compute the expectation that yp0u maximized?
loveslaveAuthor Commented:
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.
loveslaveAuthor Commented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.