[SciPy-user] multiple regression: problem with matrix algebra

John Pye john at curioussymbols.com
Sun May 6 01:03:10 EDT 2007


Hi all

I am having a little trouble with using optimize.leastsq for multiple
regression. I've used an approach based on this tute, which deals only
with single regression:
http://linuxgazette.net/115/andreasen.html

But now in my adaptation to multiple regression, I can get it to work
only if I do some dirty loop-based evaluation for my residuals. But if I
try to use elegant matrix evaluation, the fit parameters go awry:

# this doesn't work:
results = optimize.leastsq(residuals_mat, params0, args=(y,
x1,x2),full_output=1)

# this works:
#results = optimize.leastsq(residuals, params0, args=(y,
x1,x2),full_output=1)

I'm sure it's a silly mistake, but I certainly can't find it. Does
anyone have any suggestions?

Cheers
JP

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kinfit.py
Type: text/x-python
Size: 1803 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070506/3bfc9261/attachment.py>


More information about the SciPy-User mailing list