[SciPy-user] nonlinear fit with non uniform error?

Anne Archibald peridot.faceted at gmail.com
Wed Jun 20 14:02:05 EDT 2007


On 20/06/07, massimo sandal <massimo.sandal at unibo.it> wrote:
> Hi,
>
> We have a set of data that we fit to a nonlinear function using
> scipy.optimize.leastsq that, AFAIK, uses the Levenberg-Marquardt method.
>
> Talking with a collegue of another lab, he pointed me that the dataset
> we fit usually has intrinsically more noise in the first part of the
> data than the latter. So he fitted by taking into account the non
> uniform error -that is, instead of using plain chi-square, giving more
> weight to the distance from points with less intrinsic error. He told me
> that on Origin there is a function that does it. Is there something
> similar on scipy?

The easiest solution is to rescale your y values by the uncertainties
before doing the fit.

Now, if your errors are not Gaussian, least-squares is no longer the
correct approach and your life becomes more difficult...

Anne



More information about the SciPy-User mailing list