[SciPy-User] scipy.stats.pearsonr returns exactly 0.0

Andreas Hilboll lists@hilboll...
Mon Feb 4 05:23:53 CST 2013


Hi,

in a situation where scipy.stats.spearmanr and numpy.corrcoef[0,1]
return sensible results, scipy.stats.pearsonr returns exactly 0.0.

Are there situations where this is to be expected? I have sanitized my
input arrays for nans before calling the correlation methods:

    tmpdata1 = data[key1].data[:, x, y]
    tmpdata2 = data[key2].data[:, x, y]
    tmpidx = True - (np.isnan(tmpdata1) | np.isnan(tmpdata2))
    tmpdata1, tmpdata2 = tmpdata1[tmpidx], tmpdata2[tmpidx]

The results I get is:

sp.stats.linregress: 0.09.../.....
sp.stats.spearmanr:  0.331...
np.corrcoef:         0.2574...
sp.stats.pearsonr:   0.0 (exactly)

I'm a bit worried that pearsonr is exactly 0.00. Any ideas?

Cheers,
Andreas.

-- 
Andreas Hilboll
PhD Student

Institute of Environmental Physics
University of Bremen

U3145
Otto-Hahn-Allee 1
D-28359 Bremen
Germany

+49(0)421 218 62133 (phone)
+49(0)421 218 98 62133 (fax)
http://www.iup.uni-bremen.de/~hilboll


More information about the SciPy-User mailing list