[SciPy-User] [SciPy-user] Covariance matrix
Charles R Harris
charlesr.harris@gmail....
Sat Feb 11 20:47:26 CST 2012
On Fri, Feb 10, 2012 at 9:11 AM, suzana8447 <k-assem84@hotmail.com> wrote:
>
> Hello every body,
> I am using least square fit to fit some function to a given data. The fit
> is
> perfect with leastsq. Now, I need to calculate the covariance matrix
> whereby
> the diagonal terms represent the variances for the parameters.
>
> I need to know, if possible, how to extract the covariance matrix from
> leastsq. If there is no way to extract it, Are there any good methods that
> can be used to calculate the covariance matrix with high precision?
>
If you pass the optional argument full_output=1 when calling leastsq the
(scaled) covariance matrix will be returned in the slot after the solution.
It needs to be multiplied by an estimated measurement variance determined
from the residuals or by some other method. The documentation isn't quite
right on that score, it says standard deviation. The computation of the
covariance probably isn't the best numerically as its triangular factors
are multiplied before inversion, rather than vice-verse. Patches welcome ;)
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120211/7b1c00d3/attachment-0001.html
More information about the SciPy-User
mailing list