# How to find the log-likelihood function for a multiple-Gaussian fit?

Background: I have a distribution of intramolecular distances. I want to fit this distribution to multiple Gaussian functions, but I don't know how many. I am going to use the Akaike information criterion to evaluate the quality of e.g. a 3-Gaussian model vs a 4-Gaussian model, but for that I need the maximum value of the likelihood function. I don't understand what a likelihood function is, or how to find it, or what to maximize it in terms of.

To fit my data to 3 Gaussians, for example, I simply fit my data to: $$f(x) = Ae^{\frac{-(x-\mu_1)^2}{2\sigma_1^2}}+Be^{\frac{-(x-\mu_2)^2}{2\sigma_2^2}}+Ce^{\frac{-(x-\mu_3)^2}{2\sigma_3^2}}$$

where $A,B,C,\mu_1,\mu_2,\mu_3,\sigma_1,\sigma_2,\sigma_3$ are my parameters.

This guy made it seem like you don't need to maximize anything, it's just a calculation using the sum of the squared residuals: $$ln(L)=\sum_{i=1}^{N}ln\Big(\frac{1}{\sqrt{2\pi\sigma^2}}\Big)-\frac{1}{2\sigma^2}\sum_{i=1}^{N}(y_i-\hat{y_i})^2$$ where $y_i$ is the data and $\hat{y_i}$ is the model.

But the wiki page on "Maximum Likelihood Estimation" really confused me because it didn't use the sum of the squared residuals, it subtracted $\mu$ from $x_i$? Where $x_i$ is the data? Which $\mu$ is that supposed to be? I have three in my fit! I'm very confused, and would really appreciate help understanding this.

Is that formula that I wrote above for L correct for my multiple-Gaussian distribution? And if so, what is all this about maximizing it?

• The formula you wrote is wrong for a mixture of Gaussians. What you wrote is the sum of the logarithm of N Gaussians. Instead, you want to write the log of the mixture (which unfortunately does not simplify). I didn't read the whole link you posted but it looks like he is dealing with a different problem. – lacerbi Apr 4 '17 at 20:14
• Do you mean a mixture of univariate Gaussian random variables or something else? I am not following what you are saying and what you want to know. – Michael R. Chernick Apr 4 '17 at 20:15