How may I show a mixture distribution?

3 visualizzazioni (ultimi 30 giorni)
I truly appreciate if someone answers how to show a mixture distribution? My data ia attached and I know this data is not enough to claim a multimodal distribution confidently. Assuming enough data points, how I can show a multimodal dataset? I means I want to show a data set like the attached figure (the figure is not mine and I only use it to express my question). Thank you in advance!
  2 Commenti
roberto rocchetta
roberto rocchetta il 11 Apr 2021
Modificato: roberto rocchetta il 11 Apr 2021
Hi,
you can try to test unimodality with the Komogorov-Smirnov test.
If Xdata=A is your data:
Xnorm=(Xdata-mean(Xdata))/std(Xdata); % standard scale
r=kstest(Xnorm)
help kstest
Maria Amr
Maria Amr il 12 Apr 2021
roberto rocchetta, Thank you so much for your help!

Accedi per commentare.

Risposta accettata

Jeff Miller
Jeff Miller il 12 Apr 2021
Here is an example of plotting a mixture that produces a graph similar to yours example:
pd1 = makedist('normal',1,1); % probability distribution 1 is normal with mu=1, sigma=1
pd2 = makedist('normal',4,1.5); % probability distribution 2 is normal with mu=4, sigma=1.5
prob2 = 0.25; % 25% of the data comes from pd2
xrange = -2:0.01:10; % some sample x values at which to compute pdfs
pd1pdf = pd1.pdf(xrange) * (1 - prob2);
pd2pdf = pd2.pdf(xrange) * prob2;
mixpdf = pd1pdf + pd2pdf;
plot(xrange,pd1pdf);
hold on
plot(xrange,pd2pdf);
plot(xrange,mixpdf);
legend('Component1','Component 2','mixture');
Hope that helps...
  2 Commenti
Maria Amr
Maria Amr il 12 Apr 2021
Jeff Miller, Really appreciated! It is working very well. Big like!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by