How to fit a multi modal distribution using a weighted sum of PDFs?
28 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Maria Amr
el 2 de Mzo. de 2021
Comentada: Maria Amr
el 6 de Abr. de 2021
I am new to matlab and I know my question is rudimentary. I really appreciated if you help me. I have a data-set (attached) shows multi modal distributions and I want to make a fit using a weighted sum of PDFs. How may I do that?
I have applied the Kernel distribution but I am not sure is right.
clc;
clear all;
close all;
%.....................................................................
data=xlsread('A');
rr=data(:,1);%gr/cm3
[x11,y11]=hist(rr,36);
hist(rr,36);
hold on
[f,x11] = ksdensity(rr,'Bandwidth',0.0028);
plot(x11,f,'-r','LineWidth',2)
Respuesta aceptada
Bjorn Gustavsson
el 2 de Mzo. de 2021
Editada: Bjorn Gustavsson
el 2 de Mzo. de 2021
You don't have enough samples to confidently claim you have a multimodal distribution. If you simply try this with fitting exponential distributions to your data you'll see that they work reasonably OK:
PARHAT = expfit(abs(rr));
PARHATp = expfit(rr(rr>=0));
PARHATm = expfit(-rr(rr<=0));
hist(NUM,40)
hold on
x = linspace(-0.1,0.1,1001);
plot(x,30*exp(-abs(x)/PARHAT),'c')
plot(x,30*exp(-abs(x)/PARHATp),'r')
plot(x,30*exp(-abs(x)/PARHATm),'m')
There are indications that there might be a multimodal distribution, but if you do fit for a multimodal distribution you will probably find that the parameter uncertainty will be very large. First you need to gather more observations (hopefully this will be possible without too large costs in time and resources).
HTH
6 comentarios
Más respuestas (1)
Tom Lane
el 2 de Mzo. de 2021
I'm glad Bjorn provided an answer that works for you. For future reference, there is a function for fitting mixtures of normal distributions:
Also, there is an example that fits a mixture of two normals, but it can be adapted to fix mixtures of any distributions:
3 comentarios
Tom Lane
el 3 de Mzo. de 2021
@Maria Amr, I don't know what h() is in your code, but if it is a variable then you are indexing into it using values like -0.1.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!