Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fitdist for bimodal distribution

Subject: Fitdist for bimodal distribution

From: Martijn

Date: 24 Jul, 2013 07:48:23

Message: 1 of 3

Dear all,

I have a vector containing sizes obtained with measurements. When I make a histogram, it seems to be a bimodal distribution, so I would like to obtain the fit parameters for a lognormal distribution.

I tried this with fitdist('lognormal',data), but that fits a single lognormal distribution. Does any of you know how to do this for a bimodal distribution? Is that even possible with fitdist? Does anyone know a workaround?

I tried to fit the histogram (though this way I lose information) using fit(x,data,'gauss2') and fit(x,data,'lognormal'). The 'gauss2' fits a bimodal gaussian distribution, but I can't seem to find one for a bimodal lognormal distribution. Also, I prefer not to take this route, since I'm fitting the histogram instead of the raw data.

Thanks for any help!

Regards,
Martijn

Subject: Fitdist for bimodal distribution

From: Tom Lane

Date: 25 Jul, 2013 21:14:40

Message: 2 of 3

> I tried this with fitdist('lognormal',data), but that fits a single
> lognormal distribution. Does any of you know how to do this for a bimodal
> distribution? Is that even possible with fitdist? Does anyone know a
> workaround?

There is no supported bimodal distribution in fitdist, aside from something
like the beta distribution which would probably not be appropriate in your
case.

There is an example of how to use the mle function to fit a mixture of two
distributions. Look on this page

http://www.mathworks.com/help/stats/examples/fitting-custom-univariate-distributions.html

for the title "Fitting a More Complicated Distribution: A Mixture of Two
Normal." You can adapt this to a distribution other than normal if you want.

If you do decide to fit a mixture of normal distributions, check out "help
gmdistribution.fit".

-- Tom

Subject: Fitdist for bimodal distribution

From: Martijn

Date: 29 Jul, 2013 11:47:09

Message: 3 of 3

"Tom Lane" <tlane@mathworks.com> wrote in message <kss4g0$7dd$1@newscl01ah.mathworks.com>...
> > I tried this with fitdist('lognormal',data), but that fits a single
> > lognormal distribution. Does any of you know how to do this for a bimodal
> > distribution? Is that even possible with fitdist? Does anyone know a
> > workaround?
>
> There is no supported bimodal distribution in fitdist, aside from something
> like the beta distribution which would probably not be appropriate in your
> case.
>
> There is an example of how to use the mle function to fit a mixture of two
> distributions. Look on this page
>
> http://www.mathworks.com/help/stats/examples/fitting-custom-univariate-distributions.html
>
> for the title "Fitting a More Complicated Distribution: A Mixture of Two
> Normal." You can adapt this to a distribution other than normal if you want.
>
> If you do decide to fit a mixture of normal distributions, check out "help
> gmdistribution.fit".
>
> -- Tom

Thank you Tom! That is exactly what I was looking for.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us