[SciPy-dev] Testing stats.py - Error in stats.kurtosis [ATTN: Travis O.]

Travis Oliphant oliphant at ee.byu.edu
Tue Oct 29 13:13:29 EST 2002


>
> I've written some more tests for the stats module.  Since the
> stats.py module groups functions in the introductory pydoc
> comments, I organized the tests I have written into classes
> based on these groupings.  I don't know of any standard problem
> sets, so I used a basic test set [1,2,3,4] as well as a test set
> from the Mathworks web site (Matlab documentation).  The return
> value for each test was determined by using R v1.5.1 on Windows,
> and the R input used was copied into the comments for each test.
>

Great.  I'll include these tests.

> I have one test that is failing, kurtosis.  For the two test
> cases, I get using R
> [testcase] Kurtosis = 1.64
> [Mathworks] Kurtosis = 2.1658856803 [Mathworks has 2.1615]
>
> http://www.mathworks.com/access/helpdesk/help/toolbox/stats/kurtosis.shtml
>
> Using stats.py I get
> [testcase] Kurtosis = -1.36
> [Mathworks] Kurtosis = -0.834114319703
>

This looks like the difference of 3.0 between the Fisher and
Pearson definitions of kurtosis.  The default for stats.kurtosis is to use
Fisher's definition which subtracts 3.0 from the ratio of the fourth
moment to the variance.  Add fisher=0 to the kurtosis command to get
Pearson's definition.

Fisher's definition means that a normal will have a kurtosis of 0.0 which
is a usful guide.


> Let me know if this works.  I almost put it directly in CVS, but
> I think Travis O. has someone working on the stats module so I
> thought that it should be added from there.

No, I have someone working on special.  So, these are welcome tests.

-Travis O.





More information about the SciPy-Dev mailing list