# Finding maximum likelihood of a mixture normal distribution [duplicate]

I'm trying to understand how to solve the following problem:

I have to estimate each parameter of

$f(x)=pϕ(x│μ_1,σ_1^2 )+(1-p)ϕ(x|μ_2,σ_2^2)$

using maximum likelihood estimation. $ϕ(.|μ,σ^2)$ is the pdf of a normal distribution.

So, as I understand it, what I have to do is

$\mathcal{L}(\mu_1,\mu_2,\sigma_1,\sigma_2)= ∏_{i=1}^n\left(p\frac{1}{\sqrt{2π}\sigma_1i} e^{-\frac{(x_i-a_1i)^2 }{2\sigma_1i^2 }}+(1-p)\frac{1}{\sqrt{2π}\sigma_2i} e^{-\frac{(x_i-a_2i)^2}{2\sigma_2i^2 }}\right) = p^n(\frac{1}{\sqrt{2π}\sigma_1i})^n e^{-\frac{1}{2\sigma_1i^2}\sum(x_i-a_1i)^2}+(1-p)^n(\frac{1}{\sqrt{2π}\sigma_2i})^n e^{-\frac{1}{2\sigma_2i^2}\sum(x_i-a_2i)^2}$

Then $ln\mathcal{L}(\mu_1,\mu_2,\sigma_1,\sigma_2)= ln(p^n)ln(\frac{1}{\sqrt{2π}\sigma_1i})^n -\frac{1^2}{2\sigma_2i^2 }(x_i-a_1i)^2+ln((1-p)^n)ln(\frac{1}{\sqrt{2π}\sigma_2i})^n -\frac{1^2}{2\sigma_2i^2 }(x_i-a_2i)^2$

Is this ok so far? If so, could you show me how to proceed from here?

• The expansion of the logarithm is wrong. You may be interested in reading about the EM algorithm for mixture of Gaussians to solve this kind of problem. – jpmuc May 28 '17 at 8:26
• Ok, I'll do that. But could you please tell me what I've done wrong? – dmalka May 28 '17 at 12:29
• Oh, sorry. It was before the logarithm. When expanding the product expression: (a+b)(c+d) = ac + ad + bc + bd. Actually you get \sum_{i} \log (...) – jpmuc May 28 '17 at 12:55
• Is $p$ a known constant or an unknown parameter? In $ln\mathcal{L}(\mu_1,\mu_2,\sigma_1,\sigma_2)$, $p$ is not included. – user158565 May 29 '17 at 19:57