[SciPy-user] optimize.leastsq

josef.pktd@gmai... josef.pktd@gmai...
Wed Jan 21 05:58:49 CST 2009

On Wed, Jan 21, 2009 at 5:02 AM, David Trethewey <dlrt2@ast.cam.ac.uk> wrote:
> So what I'm trying to work out now is how to use the .fit() method of
> rv_continuous for a single gaussian and a double gaussian.
> David

The maximum likelihood estimator for the single gaussian is given by
the mean and variance of your data set, but also stats.norm.fit works

Your double gaussian is a mixture of gaussians and is not directly in
stats distribution. I wrote a subclass for this case as an example,
but I have to find it later, and I didn't try out the fit method.
Fitting mixtures of gaussians can also be done (in a more
sophisticated way) with the EM algorithm in the learn scikits package.

One more possibility, if you are not sure about the distributional
assumption is to use stats.kde, a gaussian kernel density estimation.
For bimodal distributions the smoothing parameter has to be changed,
you find some examples in this mailing list.

I'm not sure what to use or where to find a statistical test, for the
mixture versus unimodal distribution.


More information about the SciPy-user mailing list