[SciPy-dev] Testing stats.py - Error in stats.kurtosis

Travis Oliphant oliphant at ee.byu.edu
Thu Oct 31 15:45:06 CST 2002


> Travis
>
> 1. check_kurtosis changed
> 2. check_2d error
>
Thanks for the help.  I'm including these tests in the CVS tree, today.

But, I first have to correct errors I'm getting with them...

Regarding your questions.
>
> where b2 = array((1.0,2.0,2.64575131106))
> When I enter stats.std(a) I get:
> array([ 4.52769257,  2.12132034,  7.21110255])

I don't get these answers regardless of what I put for the second
argument. What is a for you?

> When I enter stats.std(a,1) I get:
> array([ 1.        ,  2.        ,  2.64575131])

I do get this result, though.


> Finaly, stats.std(ravel(a)) gives me:
> 3.5707142142714252

I get this too.

>
> So,
> A)  Is the intent of the check_2d to find the population
> standard deviation of each row in the array, in which case
> check_2d should be changed from
> assert_array_almost_equal(stats.std(a),b2,11)

My results don't agree with yours.  When I say
stats.std(a) it should find the standard deviation along the last
dimension of the array (axis == 1) or (axis == -1).  So, it should give
equivalent answers to stats.std(a,1).  I don't know why your version is
not doing this.  Mine is.  Are you sure you are getting the right stats
module from the right place?

>
> B)   When no axis parameter is entered into stats.std() [and by
> extention stats.var() ]

When no axis is given, the default is to use the last dimension of the
array.  There is still some debate on what the proper default behavior
should be, but currently all of the stats module (and all of scipy) should
behave like this (and does as far as I know).

The None argument to axis will ravel the array prior to applying the std
operation.

>
> I'm not much of a stats expert but I'll help where I can once
> we've decided what we are trying to do.

Thanks for your help.  It is appreciated.

-Travis




More information about the Scipy-dev mailing list