[SciPy-user] scipy.optimize.leastsq and covariance matrix meaning
massimo sandal
massimo.sandal at unibo.it
Thu Nov 6 10:10:32 EST 2008
Hi,
I have a trouble with the covariance matrix in the output of
scipy.optimize.leastsq . I am trying to find the estimated sigma of the
parameters obtained by the fit. Please bear with me since my statistics
knowledge is poor. I understand that the diagonal of the covariance
matrix should return me the variance values of each parameter.
Problems are:
1) The variance of such parameters look unreasonably large to me,
despite the fact I obtain an *excellent* fit over a lot of data points
(and values extremly well coherent with expected).
2) The non-diagonal values of the covariance are also unreasonably
large, which lets me doubt that picking simply the diagonal values is
the correct thing to do.
The residuals function is:
def residuals(params,y,x,T):
'''
Calculates the residuals of the fit
'''
lambd, pii=params
Kb=(1.38065e-23)
therm=Kb*T
err = y-( (therm*pii/4) * (((1-(x*lambd))**-2) - 1 +
(4*x*lambd)) )
return err
For example, a common entity of values is:
4390808.6184609979
3993219683.7749424
and the relative covariance matrix is
[[ 1.97019986e+29 -2.67163157e+33]
[ -2.67163157e+33 3.78415451e+37]]
...which concerns me.
m.
--
Massimo Sandal , Ph.D.
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
massimo.sandal at unibo.it
web:
http://www.biocfarm.unibo.it/samori/people/sandal.html
tel: +39-051-2094388
fax: +39-051-2094387
-------------- next part --------------
A non-text attachment was scrubbed...
Name: massimo_sandal.vcf
Type: text/x-vcard
Size: 274 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20081106/23fa5d08/attachment.vcf>
More information about the SciPy-User
mailing list