[Scipy-svn] r6965 - in trunk: doc/release scipy/stats scipy/stats/tests

scipy-svn@scip... scipy-svn@scip...
Sun Nov 28 07:38:21 CST 2010


Author: rgommers
Date: 2010-11-28 07:38:21 -0600 (Sun, 28 Nov 2010)
New Revision: 6965

Modified:
   trunk/doc/release/0.9.0-notes.rst
   trunk/scipy/stats/mstats_basic.py
   trunk/scipy/stats/stats.py
   trunk/scipy/stats/tests/test_mstats_basic.py
   trunk/scipy/stats/tests/test_stats.py
Log:
DEP: remove deprecated functions from stats module.

Modified: trunk/doc/release/0.9.0-notes.rst
===================================================================
--- trunk/doc/release/0.9.0-notes.rst	2010-11-28 13:37:52 UTC (rev 6964)
+++ trunk/doc/release/0.9.0-notes.rst	2010-11-28 13:38:21 UTC (rev 6965)
@@ -137,6 +137,11 @@
 The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has
 been deprecated since version 0.7, was removed.
 
-Several functions in ``scipy.stats`` that are available from numpy and have
-been deprecated since version 0.7 have been removed: ``std``, ``var``,
-``mean``, ``median``, ``cov`` and ``corrcoef``.
+
+``scipy.stats``
+---------------
+
+Many functions in ``scipy.stats`` that are either available from numpy or have
+been superseded, and have been deprecated since version 0.7, have been removed:
+`std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`,
+`samplestd`, `samplevar` and `erfc`.

Modified: trunk/scipy/stats/mstats_basic.py
===================================================================
--- trunk/scipy/stats/mstats_basic.py	2010-11-28 13:37:52 UTC (rev 6964)
+++ trunk/scipy/stats/mstats_basic.py	2010-11-28 13:38:21 UTC (rev 6965)
@@ -29,7 +29,6 @@
            'rankdata',
            'samplestd','samplevar','scoreatpercentile','sem','std',
            'sen_seasonal_slopes','signaltonoise','skew','skewtest','spearmanr',
-           'stderr',
            'theilslopes','threshold','tmax','tmean','tmin','trim','trimboth',
            'trimtail','trima','trimr','trimmed_mean','trimmed_std',
            'trimmed_stde','trimmed_var','tsem','ttest_1samp','ttest_onesamp',
@@ -1927,11 +1926,6 @@
     return ma.asarray(a).std(axis=axis,ddof=1)
 std.__doc__ = np.std.__doc__
 
-def stderr(a, axis=0):
-    a, axis = _chk_asarray(a, axis)
-    return a.std(axis=axis, ddof=1) / ma.sqrt(a.count(axis=axis))
-stderr.__doc__ = stats.stderr.__doc__
-
 def sem(a, axis=0):
     a, axis = _chk_asarray(a, axis)
     n = a.count(axis=axis)

Modified: trunk/scipy/stats/stats.py
===================================================================
--- trunk/scipy/stats/stats.py	2010-11-28 13:37:52 UTC (rev 6964)
+++ trunk/scipy/stats/stats.py	2010-11-28 13:38:21 UTC (rev 6965)
@@ -67,10 +67,7 @@
                   relfreq
 
 VARIABILITY:  obrientransform
-              samplevar
-              samplestd
               signaltonoise (for arrays only)
-              stderr
               sem
 
 TRIMMING FCNS:  threshold (for arrays only)
@@ -98,7 +95,6 @@
                     friedmanchisquare
 
 PROBABILITY CALCS:  chisqprob
-                    erfcc
                     zprob
                     fprob
                     betai
@@ -211,15 +207,14 @@
            'skewtest', 'kurtosistest', 'normaltest',
            'itemfreq', 'scoreatpercentile', 'percentileofscore',
            'histogram', 'histogram2', 'cumfreq', 'relfreq',
-           'obrientransform', 'samplevar', 'samplestd', 'signaltonoise',
-           'stderr', 'sem', 'zmap', 'zscore',
+           'obrientransform', 'signaltonoise', 'sem', 'zmap', 'zscore',
            'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean',
            'f_oneway', 'pearsonr', 'fisher_exact',
            'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress',
            'ttest_1samp', 'ttest_ind', 'ttest_rel',
            'kstest', 'chisquare', 'ks_2samp', 'mannwhitneyu',
            'tiecorrect', 'ranksums', 'kruskal', 'friedmanchisquare',
-           'zprob', 'erfc', 'chisqprob', 'ksprob', 'fprob', 'betai',
+           'zprob', 'chisqprob', 'ksprob', 'fprob', 'betai',
            'glm', 'f_value_wilks_lambda',
            'f_value', 'f_value_multivariate',
            'ss', 'square_of_sums',
@@ -1696,39 +1691,6 @@
         return array(nargs)
 
 
-@np.lib.deprecate(message="""
-scipy.stats.samplevar is deprecated; please update your code to use
-numpy.var.
-
-Please note that `numpy.var` axis argument defaults to None, not 0.
-""")
-def samplevar(a, axis=0):
-    """
-    Returns the sample standard deviation of the values in the passed
-    array (i.e., using N).  Axis can equal None (ravel array first),
-    an integer (the axis over which to operate)
-    """
-    a, axis = _chk_asarray(a, axis)
-    mn = np.expand_dims(np.mean(a, axis), axis)
-    deviations = a - mn
-    n = a.shape[axis]
-    svar = ss(deviations,axis) / float(n)
-    return svar
-
-@np.lib.deprecate(message="""
-scipy.stats.samplestd is deprecated; please update your code to use
-numpy.std.
-
-Please note that `numpy.std` axis argument defaults to None, not 0.
-""")
-def samplestd(a, axis=0):
-    """Returns the sample standard deviation of the values in the passed
-array (i.e., using N).  Axis can equal None (ravel array first),
-an integer (the axis over which to operate).
-"""
-    return np.sqrt(samplevar(a,axis))
-
-
 def signaltonoise(a, axis=0, ddof=0):
     """
     Calculates the signal-to-noise ratio, defined as the ratio between the mean
@@ -1757,19 +1719,6 @@
     return np.where(sd == 0, 0, m/sd)
 
 
-@np.lib.deprecate(message="""
-scipy.stats.stderr is deprecated; please update your code to use
-scipy.stats.sem.
-""")
-def stderr(a, axis=0, ddof=1):
-    """
-Returns the estimated population standard error of the values in the
-passed array (i.e., N-1).  Axis can equal None (ravel array
-first), or an integer (the axis over which to operate).
-"""
-    a, axis = _chk_asarray(a, axis)
-    return np.std(a,axis,ddof=1) / float(np.sqrt(a.shape[axis]))
-
 def sem(a, axis=0, ddof=1):
     """
     Calculates the standard error of the mean (or standard error of
@@ -1815,7 +1764,6 @@
     """
     a, axis = _chk_asarray(a, axis)
     n = a.shape[axis]
-    #s = samplestd(a,axis) / np.sqrt(n-1)
     s = np.std(a,axis=axis, ddof=ddof) / np.sqrt(n) #JP check normalization
     return s
 
@@ -3633,8 +3581,6 @@
 #####################################
 
 zprob = special.ndtr
-erfc = np.lib.deprecate(special.erfc, old_name="scipy.stats.erfc",
-                                      new_name="scipy.special.erfc")
 
 def chisqprob(chisq, df):
     """

Modified: trunk/scipy/stats/tests/test_mstats_basic.py
===================================================================
--- trunk/scipy/stats/tests/test_mstats_basic.py	2010-11-28 13:37:52 UTC (rev 6964)
+++ trunk/scipy/stats/tests/test_mstats_basic.py	2010-11-28 13:38:21 UTC (rev 6965)
@@ -441,16 +441,6 @@
         y = mstats.signaltonoise(self.testcase)
         assert_almost_equal(y,2.236067977)
 
-    def test_stderr(self):
-        """
-        this is not in R, so used
-        sqrt(var(testcase))/sqrt(4)
-        """
-##        y = stats.stderr(self.shoes[0])
-##        assert_approx_equal(y,0.775177399)
-        y = mstats.stderr(self.testcase)
-        assert_almost_equal(y,0.6454972244)
-
     def test_sem(self):
         """
         this is not in R, so used

Modified: trunk/scipy/stats/tests/test_stats.py
===================================================================
--- trunk/scipy/stats/tests/test_stats.py	2010-11-28 13:37:52 UTC (rev 6964)
+++ trunk/scipy/stats/tests/test_stats.py	2010-11-28 13:38:21 UTC (rev 6965)
@@ -962,22 +962,6 @@
     """
     testcase = [1,2,3,4]
 
-    def test_samplevar(self):
-        """
-        R does not have 'samplevar' so the following was used
-        var(testcase)*(4-1)/4  where 4 = length(testcase)
-        """
-        #y = stats.samplevar(self.shoes[0])
-        #assert_approx_equal(y,5.4081)
-        y = stats.samplevar(self.testcase)
-        assert_approx_equal(y,1.25)
-
-    def test_samplestd(self):
-        #y = stats.samplestd(self.shoes[0])
-        #assert_approx_equal(y,2.325532197)
-        y = stats.samplestd(self.testcase)
-        assert_approx_equal(y,1.118033989)
-
     def test_signaltonoise(self):
         """
         this is not in R, so used
@@ -987,15 +971,6 @@
         y = stats.signaltonoise(self.testcase)
         assert_approx_equal(y,2.236067977)
 
-    def test_stderr(self):
-        """
-        this is not in R, so used
-        sqrt(var(testcase))/sqrt(4)
-        """
-##        y = stats.stderr(self.shoes[0])
-##        assert_approx_equal(y,0.775177399)
-        y = stats.stderr(self.testcase)
-        assert_approx_equal(y,0.6454972244)
     def test_sem(self):
         """
         this is not in R, so used



More information about the Scipy-svn mailing list