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

scipy-svn@scip... scipy-svn@scip...
Mon Feb 23 18:52:27 CST 2009


Author: josef
Date: 2009-02-23 18:52:17 -0600 (Mon, 23 Feb 2009)
New Revision: 5592

Modified:
   trunk/scipy/stats/tests/test_stats.py
Log:
add test for linregress, correct existing test, see changes in r5591

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2009-02-23 20:57:32 UTC (rev 5591)
+++ trunk/scipy/stats/tests/test_stats.py	2009-02-24 00:52:17 UTC (rev 5592)
@@ -489,8 +489,19 @@
         y += np.sin(np.linspace(0, 20, 100))
 
         res = stats.linregress(x, y)
-        assert_almost_equal(res[4], 4.3609875083149268e-3)
+        assert_almost_equal(res[4], 2.3957814497838803e-3) #4.3609875083149268e-3)
 
+    def test_linregress(self):
+        '''compared with multivariate ols with pinv'''
+        x = np.arange(11)
+        y = np.arange(5,16)
+        y[[(1),(-2)]] -= 1
+        y[[(0),(-1)]] += 1
+
+        res = (1.0, 5.0, 0.98229948625750, 7.45259691e-008, 0.063564172616372733)
+        assert_array_almost_equal(stats.linregress(x,y),res,decimal=14)
+
+
 # Utility
 
 def compare_results(res,desired):



More information about the Scipy-svn mailing list