[Scipy-tickets] [SciPy] #1425: kurtosistest requires at least 4 observations

SciPy Trac scipy-tickets@scipy....
Sun Sep 11 19:54:54 CDT 2011


#1425: kurtosistest requires at least 4 observations
-------------------------+--------------------------------------------------
 Reporter:  bsouthey     |       Owner:  somebody   
     Type:  defect       |      Status:  needs_work 
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  devel      
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by josefpktd):

  * priority:  lowest => normal


Comment:

 I was trying to look at this. I think that the stats.stats version should
 raise a ValueError for n<5, similar to the change that Warren made. I
 don't think returning (0, 1) is a good answer if the sample is to small.

 R raises an exception
 {{{
 > x2 = c(0.31190987,  0.5403142 , -1.51626563, -0.64241117)
 > anscombe.test(x2)
 Error in if (pval > 1) pval <- 2 - pval :
   missing value where TRUE/FALSE needed
 In addition: Warning message:
 In sqrt(1 + 4/m3) : NaNs produced
 }}}

 The values differ a little bit compared to R, there is a mistake in the
 formula for A

 {{{
 A = 6.0 + 8.0/sqrtbeta1 *(2.0/sqrtbeta1 + np.sqrt(1+4.0/(sqrtbeta1**2)))
 }}}

 should be instead without the final `**2`, i.e.

 {{{
 A = 6.0 + 8.0/sqrtbeta1 *(2.0/sqrtbeta1 + np.sqrt(1+4.0/(sqrtbeta1)))
 }}}

 equation 3 in the reference (I don't have CRC available, but it wouldn't
 be the first imprecision or typo in there).

 correct reference

 Distribution of the Kurtosis Statistic b2 for Normal Samples
 F. J. Anscombe and William J. Glynn
 Biometrika
 Vol. 70, No. 1 (Apr., 1983), pp. 227-234
 Published by: Biometrika Trust
 Article Stable URL: http://www.jstor.org/stable/2335960

 I'm trying to prepare a pull request in the next few days, but the **2 bug
 should be removed, and some tests against R added, for 0.10.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1425#comment:3>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list