[SciPy-User] Strange behaviour from corrcoef when calculating correlation-matrix in SciPy/NumPy.

Warren Weckesser warren.weckesser@enthought....
Wed Mar 2 13:37:34 CST 2011


Looks like the meaning of the argument 'y' in cov() (which is used by
corrcoef()) was changed back in 2006:


https://github.com/numpy/numpy/commit/959f36c04ce8ca0b7bc44bb6438bddf162ad2db9#numpy/lib/function_base.py

The old behavior appears to have been more like matlab's behavior.

Warren


On Wed, Mar 2, 2011 at 1:28 PM, Pauli Virtanen <pav@iki.fi> wrote:

> On Wed, 02 Mar 2011 14:06:23 -0500, josef.pktd wrote:
> [clip]
> > I also found it a bit strange that corrcoef(x,y) creates the stacked
> > version. scipy.stats.spearmanr inherits this behavior since I rewrote
> > it. scipy.stats.pearsonr hasn't been rewritten yet.
> >
> > It didn't bug me enough, to figure out whether there is a reason for
> > this stacking behavior or not.
>
> The Matlab convention
>
>        corrcoef(x, y) == corrcoef(c_[x.ravel(), y.ravel()])
>
> is actually also a bit peculiar if you haven't seen it before -- how come
> there are now two variables, if x had variables on the rows (why not bail
> out with an error?).
>
> I don't typically deal with stuff that requires these functions, so I
> don't have an opinion, but it would have been better to do the same thing
> even if there is no real reason for it...
>
> --
> Pauli Virtanen
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110302/85b499f5/attachment.html 


More information about the SciPy-User mailing list