[SciPy-User] Using scipy to fit a bimodal distribution

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Using scipy to fit a bimodal distribution

spiff007
Hi Folks,

I have some data, which is bimodally distributed.

The initial part of the data(in red, in the figure below), seems to be exponentially distributed and the latter part(in blue, in the figure below), seems to be a gamma distribution.

See image below (& attached) :


​ 
What scipy function, i could use to fit this data, knowing that, the first mode is exponential, and the latter, seems to be gamma.
If its not possible to do it using scipy, is there another library/module i could use to do this ?

Any suggestions/pointers/advice/hacks ?

Thanks a ton,
ashish

--

“The best minds of my generation are thinking about how to make people click ads. That sucks.”  

- Jeff Hammerbacher (early fb engineer)



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

bimodal_curve_fitting_png.png (108K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using scipy to fit a bimodal distribution

Paweł Kwaśniewski
Hi Ashish,

I can recommend lmfit: https://lmfit.github.io It's and additional module, so you'll need to install it, but it's worth it. It's well documented, easy to use and provides the possibility of creating composite models (https://lmfit.github.io/lmfit-py/model.html#composite-models-adding-or-multiplying-models). I use it whenever I need to fit a double peak. It will also work with two different distributions.

Cheers,

Paweł

2018-03-16 8:14 GMT+01:00 spiff007 <[hidden email]>:
Hi Folks,

I have some data, which is bimodally distributed.

The initial part of the data(in red, in the figure below), seems to be exponentially distributed and the latter part(in blue, in the figure below), seems to be a gamma distribution.

See image below (& attached) :


​ 
What scipy function, i could use to fit this data, knowing that, the first mode is exponential, and the latter, seems to be gamma.
If its not possible to do it using scipy, is there another library/module i could use to do this ?

Any suggestions/pointers/advice/hacks ?

Thanks a ton,
ashish

--

“The best minds of my generation are thinking about how to make people click ads. That sucks.”  

- Jeff Hammerbacher (early fb engineer)



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user



_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user