[SciPy-user] Bug on 0.4.9 ?

Antonio Arauzo Azofra arauzo at decsai.ugr.es
Thu Jun 8 08:13:35 CDT 2006


DE MENTEN Sebastien wrote:
> In scipy 0.4.9, you get your results if you compute cov(transpose(t))
> instead of cov(t).

Thanks Sebastien, you are right. It seems semantic of covariance funcion 
(scipy.cov) has changed.

BEAWARE this may make your programs give wrong results if updating from 
0.4.8 to 0.4.9. The solution is using cov(t, rowvar=False). This ensures 
code will work the same way in both versions.

> However, I do not know which one should be the standard.

Probably using rows as vars is good default, as it is the same used in 
R, but i think, this should not have been changed in minor version. This 
change is not present in 0.4.9 tag at track[1]. :-? I don't understand 
what happend. Have donwloaded anything wrong?

[1] 
http://projects.scipy.org/scipy/scipy/browser/tags/0.4.9/Lib/stats/stats.py

Another doubt, in help(scipy.cov) it says:
"Help on function cov in module numpy.lib.function_base: ..."

Where is it really? in scipy.stats? or in numpy?

By the way, the function comment says that when a matrix is passed as 
argument it returns covariance matrix, but if matrix is Nx1 (or 1xN) it 
returns a number instead of a 1x1 matrix. I think this is not 
homogeneous and it is not what expected.

-- 
Saludos,
   Antonio Arauzo Azofra



More information about the SciPy-user mailing list