[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
http://www.jpk.com/unfolding-of-individual-titin-i27-octamer-i91-8.media.f229c5303ada22eb0a4ebe759457750av2.gif

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 
here:
http://en.wikipedia.org/wiki/Worm-like_chain

with results looking like that:
http://www.jpk.com/titin-force-extension-profile.media.37bc90d1dbd105742098ed8317385a48v1.gif
http://biology.plosjournals.org/perlserv/?request=slideshow&type=figure&doi=10.1371/journal.pbio.0060006&id=93367

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.

m.

*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

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


More information about the SciPy-user mailing list