[SciPy-User] leastsq not converging to optimal solution, fmin won't accept parameters

Joses Ho joses.ho@magd.ox.ac...
Wed Sep 8 16:54:37 CDT 2010


I am trying to fit to my qPCR data an exponential function where each successive y-value depends on the previous v-value in the following fashion:
y[n]  =  y[n-1] + k ln (1 + (y[n-1]/k) + b
where y[n] = current y-value being evaluated
and y[n-1] = previous y-value

I therefore have three values to fit - y0 (starting value of y), k, and b.

I define a residuals function where I compute 20 values of y, given an initial estimate of y0, k and b, and then subtract these from my 20 measured values of y.

I have tried to use scipy.optimize.leastsq on the above residuals function, but it doesn't seem to be converging on the correct values of y0,k and b.
I have tried scipy.optimize.fmin on the same function, but I get the following error:
...fsim[0] = func(x0)
...ValueError: setting an array element with a sequence.
which seems to me that it refuses to accept the x0 array I give to it, consisting of [y0,k,b].

Basically, I am trying to implement the recent method of Boggy and Woolf (PLoS 2010) [doi:10.1371/ journal.pone.0012355] in Python.
I am using SciPy 0.8.0b1 and NumPy 1.4.0 on Python 2.6.5 of the Enthought Python Distribution 6.2-2.

Any help here would be very much appreciated!


This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify the sender immediately. Do not copy or use it for any purpose, or disclose its contents to any other person.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100908/716acaea/attachment-0001.html 

More information about the SciPy-User mailing list