[SciPy-User] Strange behaviour from corrcoef when calculating correlation-matrix in SciPy/NumPy.
Pauli Virtanen
pav at iki.fi
Wed Mar 2 14:28:43 EST 2011
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
More information about the SciPy-User
mailing list