[SciPy-user] scipy.optimize.leastsq and covariance matrix meaning
Tue Nov 11 06:15:39 CST 2008
Robert Kern wrote:
> On Mon, Nov 10, 2008 at 05:13, massimo sandal <email@example.com> wrote:
>> massimo sandal wrote:
>>> I'll try to sketch up a script reproducing the core of the problem with
>>> actual data.
>> Here it is. Can anyone give it a look to help me understand if and how to
>> make sense of the covariance matrix?
> The covariance matrix does need some scaling before it can be
> interpreted statistically. Basically, if you are doing nonlinear least
> squares as a statistical procedure, rather than a purely numerical
> one, the residuals need to be scaled so that they are in units of
> standard deviations of the measurement error for each individual
> measurement. If you don't know what that is, then you can estimate it
> from the fitted residuals. The parameter estimate is unchanged, but
> you will need to rescale the covariance matrix of the estimate by
> multiplying it by the residual variance.
> scipy.odr does most of this for you. Attached is a version of your
> code using scipy.odr. Here is the text output:
> Fitted parameters: [ 4.90666526e+06 4.78090340e+09]
> Covariance: [[ 1.72438988e+31 -1.64258997e+35]
> [ -1.64258997e+35 1.57791262e+39]]
> Residual variance: 2.83606592894e-22
> Scaled error bars: [ 6.99319913e+04 6.68959208e+08]
> Scaled covariance: [[ 4.89048340e+09 -4.65849344e+13]
> [ -4.65849344e+13 4.47506422e+17]]
Thanks a lot! What I need are the scaled error bars, isn't it?
(By the way: any good tutorial reference/book on this kind of numerical
things? I am a molecular biologist now doing biophysics, and while
enjoying it a lot, I feel behind on a lot of technical stuff)
Massimo Sandal , Ph.D.
University of Bologna
Department of Biochemistry "G.Moruzzi"
Via Irnerio 48, 40126 Bologna, Italy
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 274 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20081111/929c0119/attachment-0001.vcf
More information about the SciPy-user