I want to find the log-likelihood value after mle() found parameters for mixture distribution of two normal distribution

8 visualizaciones (últimos 30 días)
I plotted the pdf histogram of a set of data, and it looked like there are two peaks. I wanted to estimate the mixing probability, mean and standard deviation of each subpopulation, so I used a method described in this page (link below).
Briefly, I used a method to fit custom distributions assuming the distribution is a mixture of two normal distributions. I have found the parameters that fit the distritbution reasonably well upon visual inspection. I understand that I can generate 95%CIs for these estimated parameters. However, I would also like to report a different value to evaluate the goodness of fit of this model. My understanding is that since mle() is a likelihood-based method and log-likelihood is a way to evaluate how good the model fits, I would like to find this log-likelihood value for this set of parameters. Alternatively, if anyone could suggest other ways to report the goodness of fit, it would be great.
Here is the code I used:
pdf_normmixture = @(data,p,mu1,mu2,sigma1,sigma2) ...
p*normpdf(data,mu1,sigma1) + (1-p)*normpdf(data,mu2,sigma2);
pStart = .5;
muStart = quantile(x3,[.25 .75])
sigmaStart = sqrt(var(x3) - .25*diff(muStart).^2)
start = [pStart muStart sigmaStart sigmaStart];
lb = [0 -Inf -Inf 0 0];
ub = [1 Inf Inf Inf Inf];
options = statset('MaxIter',300,'MaxFunEvals',600);
[paramEsts,pci] = mle(data,'pdf',pdf_normmixture,'Start',start, ...
'LowerBound',lb,'UpperBound',ub)
Thanks in advance!

Respuestas (1)

Ayush Modi
Ayush Modi el 30 de Oct. de 2023
Hi Alex,
As per my understanding, you would like to calculate the log-likelihood value for a set of parameters. You can achieve this using the “fitdist” function. Here is an example to demonstrate how you can accomplish this:
pd = fitdist(data,'normal');
result = pd.NLogL
Please refer to the following MathWorks documentation for more information on “fitdist” function and various distributions:
Note: Select the distribution instead of “normal” as per the distribution of the “data”
I hope this resolves the issue you were facing.

Etiquetas

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by