[Numpy-discussion] corrcoef

2007-09-06 Thread John Hunter
Is it desirable that numpy.corrcoef for two arrays returns a 2x2 array rather than a scalar In [10]: npy.corrcoef(npy.random.rand(10), npy.random.rand(10)) Out[10]: array([[ 1., -0.16088728], [-0.16088728, 1.]]) I always end up extracting the 0,1 element anyway. What is

Re: [Numpy-discussion] corrcoef

2007-09-06 Thread Sven Schreiber
John Hunter schrieb: Is it desirable that numpy.corrcoef for two arrays returns a 2x2 array rather than a scalar In [10]: npy.corrcoef(npy.random.rand(10), npy.random.rand(10)) Out[10]: array([[ 1., -0.16088728], [-0.16088728, 1.]]) I always end up extracting

Re: [Numpy-discussion] corrcoef of masked array

2007-05-30 Thread Jesper Larsen
On Friday 25 May 2007 19:18, Robert Kern wrote: Jesper Larsen wrote: Hi numpy users, I have a masked array of dimension (nvariables, nobservations) that contain missing values at arbitrary points. Is it safe to rely on numpy.corrcoeff to calculate the correlation coefficients of a

Re: [Numpy-discussion] corrcoef of masked array

2007-05-30 Thread Robert Kern
Jesper Larsen wrote: Here is my solution for calculating the correlation coefficients for masked arrays. Comments are appreciated: def macorrcoef(data1, data2): Calculates correlation coefficients taking masked out values into account. It is assumed (but not checked) that