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

eat e.antero.tammi@gmail....
Fri Mar 4 01:21:51 CST 2011


Hi

On Fri, Mar 4, 2011 at 1:56 AM, Pauli Virtanen <pav@iki.fi> wrote:

> On Thu, 03 Mar 2011 22:18:31 +0200, eat wrote:
>
> >> *corrcoef([X(:) Y(:)]) %(1*
> > ans =
> >    1.00000   0.26328
> >    0.26328   1.00000
> [clip]
> >> *corrcoef(X, Y) %(3*
> > ans =
> >    0.69462   0.13884
> >   -0.43644   0.31623
>
> You made a mistake here. The two always return the same results (cut and
> paste):
>
No, no mistake here,  it's really the output from octave 3.2.4 (and if I
remember correct, versions of matlab around 2005 behaved similar). But
matlab seems to be consistent now then.

Regards,
eat

>
> >> X= [1 2 7 3; 2 1 1 2]'
>
> X =
>
>     1     2
>     2     1
>     7     1
>     3     2
>
> >> Y= [4 2 7 1; 9 1 7 3]'
>
> Y =
>
>     4     9
>     2     1
>     7     7
>     1     3
>
> >> corrcoef([X(:) Y(:)])
>
> ans =
>
>    1.0000    0.2633
>    0.2633    1.0000
>
> >> corrcoef(X, Y)
>
> ans =
>
>    1.0000    0.2633
>    0.2633    1.0000
>
> _______________________________________________
> 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/20110304/d2db7d94/attachment-0001.html 


More information about the SciPy-User mailing list