[Scipy-tickets] [SciPy] #802: problems with skew and kurtosis for some distributions

SciPy scipy-tickets@scipy....
Sun Nov 30 23:14:13 CST 2008


#802: problems with skew and kurtosis for some distributions
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  josefpktd
     Type:  defect       |      Status:  new      
 Priority:  normal       |   Milestone:           
Component:  scipy.stats  |     Version:           
 Severity:  normal       |    Keywords:           
-------------------------+--------------------------------------------------
 There are still some problems with skew and kurtosis, i.e.
 distfn.stats(*args,moments='sk').
 For some distributions the problem comes when _stats returns some numbers
 and some None. rv_continuous.stats might not handle all cases with some
 `None`s correctly.

 Below example from running sample skew and kurtosis test from
 test_continuous_basic.py, currently commented out because of problems.
 Also, there are currently no tests for 3rd and higher moments. Tests for
 mean and variance all pass.

 {{{
 ======================================================================
 ERROR:
 test_continuous_basic.test_cont_basic(<scipy.stats.distributions.nct_gen
 object at 0x0184AD90>, (14, 0.24045031331198066), 0.019523823928802822,
 0.033210
 792162384095, 'nct')
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "C:\Programs\Python25\lib\site-
 packages\nose-0.10.4-py2.5.egg\nose\case.p
 y", line 182, in runTest
     self.test(*self.arg)
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 new\dist\Programs\Python25\Li
 b\site-packages\scipy\stats\tests\test_continuous_basic.py", line 274, in
 check_
 sample_skew_kurt
     skew,kurt = distfn.stats(moments='sk',*arg)
   File "c:\josef\_progs\building\scipy\scipy-trunk-
 new\dist\programs\python25\li
 b\site-packages\scipy\stats\distributions.py", line 705, in stats
     mu3 = g1*np.power(mu2,1.5) #(mu2**1.5) breaks down for nan and inf
 TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and
 'float'

 ======================================================================
 ERROR:
 test_continuous_basic.test_cont_basic(<scipy.stats.distributions.pareto_g
 en object at 0x0184AE70>, (2.621716532144454,), 5.7033158762623577,
 44.341915484
 875486, 'pareto')
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "C:\Programs\Python25\lib\site-
 packages\nose-0.10.4-py2.5.egg\nose\case.p
 y", line 182, in runTest
     self.test(*self.arg)
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 new\dist\Programs\Python25\Li
 b\site-packages\scipy\stats\tests\test_continuous_basic.py", line 274, in
 check_
 sample_skew_kurt
     skew,kurt = distfn.stats(moments='sk',*arg)
   File "c:\josef\_progs\building\scipy\scipy-trunk-
 new\dist\programs\python25\li
 b\site-packages\scipy\stats\distributions.py", line 705, in stats
     mu3 = g1*np.power(mu2,1.5) #(mu2**1.5) breaks down for nan and inf
 TypeError: unsupported operand type(s) for ** or pow(): 'NoneType' and
 'float'

 ======================================================================
 ======================================================================
 FAIL:
 test_continuous_basic.test_cont_basic(<scipy.stats.distributions.burr_gen
 object at 0x01837430>, (10.5, 4.2999999999999998), 1.6076516052164003,
 4.7031190
 116268391, 'burr')
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "C:\Programs\Python25\lib\site-
 packages\nose-0.10.4-py2.5.egg\nose\case.p
 y", line 182, in runTest
     self.test(*self.arg)
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 new\dist\Programs\Python25\Li
 b\site-packages\scipy\stats\tests\test_continuous_basic.py", line 277, in
 check_
 sample_skew_kurt
     check_sample_meanvar( sk, kurt, msg + 'sample kurtosis test')
   File "C:\Josef\_progs\building\scipy\scipy-trunk-
 new\dist\Programs\Python25\Li
 b\site-packages\scipy\stats\tests\test_continuous_basic.py", line 283, in
 check_
 sample_meanvar
     ' - finite moment')
   File "C:\Programs\Python25\lib\site-packages\numpy\testing\utils.py",
 line 208
 , in assert_almost_equal
     return assert_array_almost_equal(actual, desired, decimal, err_msg)
   File "C:\Programs\Python25\lib\site-packages\numpy\testing\utils.py",
 line 311
 , in assert_array_almost_equal
     header='Arrays are not almost equal')
   File "C:\Programs\Python25\lib\site-packages\numpy\testing\utils.py",
 line 296
 , in assert_array_compare
     raise AssertionError(msg)
 AssertionError:
 Arrays are not almost equal
 burrsample kurtosis test - finite moment
 (mismatch 100.0%)
  x: array(4.7031190116268391)

  y: array(112616.27017219499)
 }}}

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


More information about the Scipy-tickets mailing list