[SciPy-user] scipy.optimize.leastsq and covariance matrix meaning

massimo sandal massimo.sandal@unibo...
Mon Nov 10 09:29:02 CST 2008

Bruce Southey wrote:
> massimo sandal 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?
>> m.
> There is some problem with your model with respect to your data. Looking 
> at the plot of x and y, the relationship is linear with a correlation of 
> 0.86. There is no hint of a non-linear relationship although a spline or 
> similar local polynomial method could give a nicer fit. I do not know 
> what you would expect to see from your function but you should also plot 
> the expected model using typical values of your parameters.
> I would suggest you explore fitting polynomial models first (could only 
> get a linear term for x in what you provided) and splines before doing 
> nonlinear models.

The kind of things I am fitting is a single molecule force spectroscopy 
force curve: see for example

and I am fitting peaks using the worm-like chain equation (actually, in 
the script I use the inverse valus of the parameters) that you can find 

with results looking like that:

The model is non-linear because the physics underlying the data is 
non-linear. I am not "choosing" the equation*, I am applying that 
equation to find parameters from the curve.

What I have pasted is just the section of a much larger data plot. The 
section can seem almost linear, but the non-linear fit on that section 
fits perfectly also the remaining sections -as expected.
Fitting the whole peak or only the last portion of it does not change 
significantly the fit or the output parameters.

The whole software I am working on is Hooke, available at 
http://code.google.com/p/hooke , in case anyone is interested.


*strictly speaking the are subtly different models to choose from indeed 
(WLC, FJC, etc.), but WLC is the simpler and more widespread and is 
enough for what I mean to do

Massimo Sandal , Ph.D.
University of Bologna
Department of Biochemistry "G.Moruzzi"

snail mail:
Via Irnerio 48, 40126 Bologna, Italy



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://projects.scipy.org/pipermail/scipy-user/attachments/20081110/54fb2c0f/attachment.vcf 

More information about the SciPy-user mailing list