[Scipy-svn] r5596 - trunk/scipy/stats/tests

scipy-svn@scip... scipy-svn@scip...
Tue Feb 24 23:39:33 CST 2009


Author: josef
Date: 2009-02-24 23:39:31 -0600 (Tue, 24 Feb 2009)
New Revision: 5596

Modified:
   trunk/scipy/stats/tests/test_morestats.py
   trunk/scipy/stats/tests/test_stats.py
Log:
add some tests for stats.tests verified with R

Modified: trunk/scipy/stats/tests/test_morestats.py
===================================================================
--- trunk/scipy/stats/tests/test_morestats.py	2009-02-24 23:38:26 UTC (rev 5595)
+++ trunk/scipy/stats/tests/test_morestats.py	2009-02-25 05:39:31 UTC (rev 5596)
@@ -111,10 +111,16 @@
         assert_array_equal(nums,[3,3,2,2])
 
 def test_fligner():
-    #this is a regression test for replacing np.var
+    #numbers from R: fligner.test in package stats
     x1=np.arange(5)
     assert_array_almost_equal(stats.fligner(x1,x1**2),
-                       (3.2282229927203558, 0.072379187848207877),11)
+                       (3.2282229927203536, 0.072379187848207877), 11)
 
+def test_mood():
+    #numbers from R: mood.test in package stats
+    x1=np.arange(5)
+    assert_array_almost_equal(stats.mood(x1,x1**2),
+            (-1.3830857299399906, 0.16663858066771478), 11)
+
 if __name__ == "__main__":
     run_module_suite()

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2009-02-24 23:38:26 UTC (rev 5595)
+++ trunk/scipy/stats/tests/test_stats.py	2009-02-25 05:39:31 UTC (rev 5596)
@@ -1249,7 +1249,16 @@
     assert_equal(v, vc)
     assert_array_almost_equal(sk, skc, decimal=13) #not sure about precision
     assert_array_almost_equal(kurt, kurtc, decimal=13)
-    
+
+def test_normalitytests():
+    # numbers verified with R: dagoTest in package fBasics
+    st_normal, st_skew, st_kurt = (3.92371918, 1.98078826, -0.01403734)
+    pv_normal, pv_skew, pv_kurt = (0.14059673, 0.04761502,  0.98880019)
+    x = np.array((-2,-1,0,1,2,3)*4)**2
+    yield assert_array_almost_equal, stats.normaltest(x), (st_normal, pv_normal)
+    yield assert_array_almost_equal, stats.skewtest(x), (st_skew, pv_skew)
+    yield assert_array_almost_equal, stats.kurtosistest(x), (st_kurt, pv_kurt)
+
 def test_obrientransform():
     #this is a regression test to check np.var replacement
     #I didn't separately verigy the numbers



More information about the Scipy-svn mailing list