[SciPy-User] [SciPy-user] Covariance Matrix
Charles R Harris
charlesr.harris@gmail....
Fri Jun 18 09:13:44 CDT 2010
On Fri, Jun 18, 2010 at 7:31 AM, P3trus <marco.halder@mytum.de> wrote:
>
> Hello im sorry if this is a doublepost, but I'm not used to mailling lists.
>
> I'd like to know if there is a build in function to get the covariance
> matrix of the fit parameter from a polynomial fit.
> I tried polyfit() but it doesn't return a covariance matrix.Is there
> another
> way to get it? Or do i have to calculate it manually and what would be an
> effective way?
>
Polyfit call lstsq, and lstsq in turn calls the lapack function dgelsd,
which doesn't seem to return the needed information, although it may be
buried among the returns in undocumented form. Since I usually want to see
the covariance, this is annoying. i've been thinking we should modify lstsq
so that it is more useful, but in the meantime, if you are solving Ax = y,
then the covariance is (A^T*A)^{-1}*sigma**2, where sigma is the estimated
standard deviation of the measurement errors. The (A^T*A)^{-1} part can be
gotten from A in one of its factored forms. The tricky part is estimating
the errors since 1) they are often correlated instead of independent and 2)
their variance may vary from data point to data point. Which is to say the
estimated covariance matrix is useful, but probably not statistically
rigorous.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100618/200b5dbb/attachment.html
More information about the SciPy-User
mailing list