# [SciPy-User] [SciPy-user] Covariance matrix

Johannes Eckstein eckjoh2@web...
Mon Feb 13 02:59:20 CST 2012

```Hi All,
I have an additional question to that below.

how can I do a matrix multiplication of a matrix X with shape: (240001, 4)

M = X * X.H

when I do this I get the following:
return N.dot(self, asmatrix(other))
ValueError: array is too big.

What is the best way to avoid this error?

Johannes
>
>
> On Fri, Feb 10, 2012 at 9:11 AM, suzana8447 <k-assem84@hotmail.com
> <mailto: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
>
>
> _______________________________________________
> 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/20120213/367745cc/attachment.html
```