[Scipy-svn] r6964 - in trunk/scipy/stats: . tests

scipy-svn@scip... scipy-svn@scip...
Sun Nov 28 07:37:52 CST 2010


Author: rgommers
Date: 2010-11-28 07:37:52 -0600 (Sun, 28 Nov 2010)
New Revision: 6964

Modified:
   trunk/scipy/stats/mstats_basic.py
   trunk/scipy/stats/stats.py
   trunk/scipy/stats/tests/test_stats.py
Log:
DEP: remove z and zs from the stats module.

Modified: trunk/scipy/stats/mstats_basic.py
===================================================================
--- trunk/scipy/stats/mstats_basic.py	2010-11-28 13:37:29 UTC (rev 6963)
+++ trunk/scipy/stats/mstats_basic.py	2010-11-28 13:37:52 UTC (rev 6964)
@@ -1943,14 +1943,15 @@
     a = ma.asarray(a)
     z = (score-a.mean(None)) / a.std(axis=None, ddof=1)
     return z
-z.__doc__ = stats.z.__doc__
+# where do we get the doc from? stats.z has been removed
+# z.__doc__ = stats.zscore_compare.__doc__
 
 def zs(a):
     a = ma.asarray(a)
     mu = a.mean(axis=0)
     sigma = a.std(axis=0,ddof=0)
     return (a-mu)/sigma
-zs.__doc__ = stats.zs.__doc__
+zs.__doc__ = stats.zscore.__doc__
 
 def zmap(scores, compare, axis=0):
     (scores, compare) = (ma.asarray(scores), ma.asarray(compare))

Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py	2010-11-28 13:37:29 UTC (rev 6963)
+++ trunk/scipy/stats/stats.py	2010-11-28 13:37:52 UTC (rev 6964)
@@ -72,8 +72,6 @@
               signaltonoise (for arrays only)
               stderr
               sem
-              z
-              zs
 
 TRIMMING FCNS:  threshold (for arrays only)
                 trimboth
@@ -214,7 +212,7 @@
            'itemfreq', 'scoreatpercentile', 'percentileofscore',
            'histogram', 'histogram2', 'cumfreq', 'relfreq',
            'obrientransform', 'samplevar', 'samplestd', 'signaltonoise',
-           'stderr', 'sem', 'z', 'zs', 'zmap', 'zscore',
+           'stderr', 'sem', 'zmap', 'zscore',
            'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean',
            'f_oneway', 'pearsonr', 'fisher_exact',
            'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress',
@@ -1821,35 +1819,7 @@
     s = np.std(a,axis=axis, ddof=ddof) / np.sqrt(n) #JP check normalization
     return s
 
-@np.lib.deprecate(message="""
-scipy.stats.z is deprecated; please update your code to use
-scipy.stats.zscore_compare.
-""")
-def z(a, score):
-    """
-Returns the z-score of a given input score, given thearray from which
-that score came.  Not appropriate for population calculations, nor for
-arrays > 1D.
 
-"""
-    z = (score-np.mean(a,None)) / samplestd(a)
-    return z
-
-@np.lib.deprecate(message="""
-scipy.stats.zs is deprecated; please update your code to use
-scipy.stats.zscore.
-""")
-def zs(a):
-    """
-Returns a 1D array of z-scores, one for each score in the passed array,
-computed relative to the passed array.
-
-"""
-    mu = np.mean(a,None)
-    sigma = samplestd(a)
-    return (array(a)-mu)/sigma
-
-
 def zscore(a, axis=0, ddof=0):
     """
     Calculates the z score of each value in the sample, relative to the sample
@@ -1913,7 +1883,6 @@
         return (a - mns) / sstd
 
 
-
 def zmap(scores, compare, axis=0, ddof=0):
     """
     Calculates the relative z-scores.

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2010-11-28 13:37:29 UTC (rev 6963)
+++ trunk/scipy/stats/tests/test_stats.py	2010-11-28 13:37:52 UTC (rev 6964)
@@ -1006,28 +1006,10 @@
         y = stats.sem(self.testcase)
         assert_approx_equal(y,0.6454972244)
 
-    def test_z(self):
-        """
-        not in R, so used
-        (10-mean(testcase,axis=0))/sqrt(var(testcase)*3/4)
-        """
-        y = stats.z(self.testcase,np.mean(self.testcase, axis=0))
-        assert_almost_equal(y,0.0)
-
-    def test_zs(self):
-        """
-        not in R, so tested by using
-        (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4)
-        """
-        y = stats.zs(self.testcase)
-        desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999])
-        assert_array_almost_equal(desired,y,decimal=12)
-
     def test_zmap(self):
         """
         not in R, so tested by using
         (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4)
-        copied from test_zs
         """
         y = stats.zmap(self.testcase,self.testcase)
         desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999])
@@ -1037,7 +1019,6 @@
         """
         not in R, so tested by using
         (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4)
-        copied from test_zs as regression test for new function
         """
         y = stats.zscore(self.testcase)
         desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999])



More information about the Scipy-svn mailing list