[SciPy-User] leastsq

Frédéric Parrenin parrenin.ujf@gmail....
Thu Jun 27 09:13:33 CDT 2013

Dear Matt,

Yes, leastsq is probably what I need.
As Josef suggested, I can decompose the observation covariance matrix using
Choleski to transform the model into one with independent observations.

It is still not very clear how to obtain the analyzed (or posterior)
covariance matrix around the solution.
At first glance, cov_x is what we are looking for but when looking at the
doc, it specifies:

Uses the fjac and ipvt optional outputs to construct an estimate of the
jacobian around the solution. None if a singular matrix encountered
(indicates very flat curvature in some direction). This matrix must be
multiplied by the residual variance to get the covariance of the parameter
estimates – see curve_fit.

Is not jacobian an error in the documentation? I would have expected

Best regards,


2013/6/27 Matt Newville <newville@cars.uchicago.edu>

> Hi,
> I'm pretty baffled by these questions.   optimize.leastsq() does not
> take a covariance matrix as input, but can give one as output.   It
> can take functions used to compute the Jacobian... Perhaps that would
> accomplish what you're trying to do?
> optimize.curve_fit() is a wrapper around leastsq() for the common case
> of "fitting data" in which one has a set of observations at a set of
> sampled "data points", and a set of variables used in a model for the
> data.     Like leastsq(), it returns the covariance.  If curve_fit()
> does what you need but seems sup-optimal, than leastsq() is probably
> what you want to use.
> Hope that helps, but maybe I'm not understanding what you're trying to do.
> --Matt Newville
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130627/c182eb54/attachment.html 

More information about the SciPy-User mailing list