numpy/scipy: correlation

Robert Kern robert.kern at gmail.com
Sat Nov 11 07:31:17 EST 2006


Robert Kern wrote:
> robert wrote:
>> Is there a ready made function in numpy/scipy to compute the correlation y=mx+o of an X and Y fast: 
>> m, m-err, o, o-err, r-coef,r-coef-err ?

> scipy.optimize.leastsq() can be told to return the covariance matrix of the
> estimated parameters (m and o in your example; I have no idea what you think
> r-coeff is).

Ah, the correlation coefficient itself. Since correlation coefficients are weird
beasts constrained to [-1, 1], standard gaussian errors like you are expecting
for m-err and o-err don't apply. No, there's currently no function in numpy or
scipy that will do something sophisticated enough to be reliable. Here's an option:

  http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=155684

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list