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

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Nov 29 09:46:33 EST 2010


Author: rgommers
Date: 2010-11-29 08:46:33 -0600 (Mon, 29 Nov 2010)
New Revision: 6977

Modified:
   trunk/doc/release/0.9.0-notes.rst
   trunk/scipy/stats/mstats_basic.py
   trunk/scipy/stats/tests/test_mstats_basic.py
Log:
DEP: remove deprecated functions from mstats, in line with changes to stats.

Modified: trunk/doc/release/0.9.0-notes.rst
===================================================================
--- trunk/doc/release/0.9.0-notes.rst	2010-11-29 14:46:00 UTC (rev 6976)
+++ trunk/doc/release/0.9.0-notes.rst	2010-11-29 14:46:33 UTC (rev 6977)
@@ -148,4 +148,5 @@
 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`, `pdfapprox`, `pdf_moments` and `erfc`.
+`samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`.  These changes
+are mirrored in ``scipy.stats.mstats``.

Modified: trunk/scipy/stats/mstats_basic.py
===================================================================
--- trunk/scipy/stats/mstats_basic.py	2010-11-29 14:46:00 UTC (rev 6976)
+++ trunk/scipy/stats/mstats_basic.py	2010-11-29 14:46:33 UTC (rev 6977)
@@ -13,7 +13,6 @@
 
 __all__ = ['argstoarray',
            'betai',
-           'cov',  # from np.ma
            'chisquare','count_tied_groups',
            'describe',
            'f_oneway','f_value_wilks_lambda','find_repeats','friedmanchisquare',
@@ -27,13 +26,13 @@
            'obrientransform',
            'pearsonr','plotting_positions','pointbiserialr',
            'rankdata',
-           'samplestd','samplevar','scoreatpercentile','sem','std',
+           'scoreatpercentile','sem',
            'sen_seasonal_slopes','signaltonoise','skew','skewtest','spearmanr',
            'theilslopes','threshold','tmax','tmean','tmin','trim','trimboth',
            'trimtail','trima','trimr','trimmed_mean','trimmed_std',
            'trimmed_stde','trimmed_var','tsem','ttest_1samp','ttest_onesamp',
            'ttest_ind','ttest_rel','tvar',
-           'var','variation',
+           'variation',
            'winsorize',
            'zmap', 'zscore'
            ]
@@ -301,11 +300,8 @@
     """Returns the sign of x, or 0 if x is masked."""
     return ma.filled(np.sign(x), 0)
 
-cov = ma.cov
 
-corrcoef = ma.corrcoef
 
-
 def pearsonr(x,y):
     """Calculates a Pearson correlation coefficient and the p-value for testing
     non-correlation.
@@ -1883,49 +1879,6 @@
     return m/sd
 
 
-def samplevar(data, axis=0):
-    """Returns a biased estimate of the variance of the data, as the average
-    of the squared deviations from the mean.
-
-    Parameters
-    ----------
-        data : sequence
-            Input data
-        axis : {0, int} optional
-            Axis along which to compute. If None, the computation is performed
-            on a flat version of the array.
-    """
-    return ma.asarray(data).var(axis=axis,ddof=0)
-
-
-def samplestd(data, axis=0):
-    """Returns a biased estimate of the standard deviation of the data, as the
-    square root of the average squared deviations from the mean.
-
-    Parameters
-    ----------
-        data : sequence
-            Input data
-        axis : {0,int} optional
-            Axis along which to compute. If None, the computation is performed
-            on a flat version of the array.
-
-    Notes
-    -----
-        samplestd(a) is equivalent to a.std(ddof=0)
-
-    """
-    return ma.asarray(data).std(axis=axis,ddof=0)
-
-
-def var(a,axis=None):
-    return ma.asarray(a).var(axis=axis,ddof=1)
-var.__doc__ = np.var.__doc__
-
-def std(a,axis=None):
-    return ma.asarray(a).std(axis=axis,ddof=1)
-std.__doc__ = np.std.__doc__
-
 def sem(a, axis=0):
     a, axis = _chk_asarray(a, axis)
     n = a.count(axis=axis)

Modified: trunk/scipy/stats/tests/test_mstats_basic.py
===================================================================
--- trunk/scipy/stats/tests/test_mstats_basic.py	2010-11-29 14:46:00 UTC (rev 6976)
+++ trunk/scipy/stats/tests/test_mstats_basic.py	2010-11-29 14:46:33 UTC (rev 6977)
@@ -193,34 +193,6 @@
              2.8,2.8,2.5,2.4,2.3,2.1,1.7,1.7,1.5,1.3,1.3,1.2,1.2,1.1,
              0.8,0.7,0.6,0.5,0.2,0.2,0.1,np.nan]
         assert_almost_equal(mstats.pointbiserialr(x, y)[0], 0.36149, 5)
-    #
-    def test_cov(self):
-        "Tests the cov function."
-        x = ma.array([[1,2,3],[4,5,6]], mask=[[1,0,0],[0,0,0]])
-        c = mstats.cov(x[0])
-        assert_equal(c, x[0].var(ddof=1))
-        c = mstats.cov(x[1])
-        assert_equal(c, x[1].var(ddof=1))
-        c = mstats.cov(x)
-        assert_equal(c[1,0], (x[0].anom()*x[1].anom()).sum())
-        #
-        x = [[nan,nan,  4,  2, 16, 26,  5,  1,  5,  1,  2,  3,  1],
-             [  4,  3,  5,  3,  2,  7,  3,  1,  1,  2,  3,  5,  3],
-             [  3,  2,  5,  6, 18,  4,  9,  1,  1,nan,  1,  1,nan],
-             [nan,  6, 11,  4, 17,nan,  6,  1,  1,  2,  5,  1,  1]]
-        x = ma.fix_invalid(x).T
-        (winter,spring,summer,fall) = x.T
-        #
-        assert_almost_equal(mstats.cov(winter,winter,bias=True),
-                            winter.var(ddof=0))
-        assert_almost_equal(mstats.cov(winter,winter,bias=False),
-                            winter.var(ddof=1))
-        assert_almost_equal(mstats.cov(winter,spring)[0,1], 7.7)
-        assert_almost_equal(mstats.cov(winter,spring)[1,0], 7.7)
-        assert_almost_equal(mstats.cov(winter,summer)[0,1], 19.1111111, 7)
-        assert_almost_equal(mstats.cov(winter,summer)[1,0], 19.1111111, 7)
-        assert_almost_equal(mstats.cov(winter,fall)[0,1], 20)
-        assert_almost_equal(mstats.cov(winter,fall)[1,0], 20)
 
 
 class TestTrimming(TestCase):
@@ -403,35 +375,7 @@
          note that length(testcase) = 4
     """
     testcase = ma.fix_invalid([1,2,3,4,np.nan])
-    #
-    def test_std(self):
-        y = mstats.std(self.testcase)
-        assert_almost_equal(y,1.290994449)
 
-    def test_var(self):
-        """
-        var(testcase) = 1.666666667 """
-        #y = stats.var(self.shoes[0])
-        #assert_approx_equal(y,6.009)
-        y = mstats.var(self.testcase)
-        assert_almost_equal(y,1.666666667)
-
-    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 = mstats.samplevar(self.testcase)
-        assert_almost_equal(y,1.25)
-
-    def test_samplestd(self):
-        #y = stats.samplestd(self.shoes[0])
-        #assert_approx_equal(y,2.325532197)
-        y = mstats.samplestd(self.testcase)
-        assert_almost_equal(y,1.118033989)
-
     def test_signaltonoise(self):
         """
         this is not in R, so used




More information about the Scipy-svn mailing list