Ejemplo n.º 1
0
 def test_maskedarray_input(self):
     # Add some masked values, test result doesn't change
     x = np.array((-2, -1, 0, 1, 2, 3) * 4)**2
     xm = np.ma.array(np.r_[np.inf, x, 10],
                      mask=np.r_[True, [False] * x.size, True])
     assert_allclose(mstats.normaltest(xm), stats.normaltest(x))
     assert_allclose(mstats.skewtest(xm), stats.skewtest(x))
     assert_allclose(mstats.kurtosistest(xm), stats.kurtosistest(x))
Ejemplo n.º 2
0
 def test_skewtest(self):
     # this test is for 1D data
     for n in self.get_n():
         if n > 8:
             x, y, xm, ym = self.generate_xy_sample(n)
             r = stats.skewtest(x)
             rm = stats.mstats.skewtest(xm)
             assert_equal(r[0], rm[0])
Ejemplo n.º 3
0
    def test_skewtest_2D_WithMask(self):
        nx = 2
        for n in self.get_n():
            if n > 8:
                x, y, xm, ym = self.generate_xy_sample2D(n, nx)
                r = stats.skewtest(x)
                rm = stats.mstats.skewtest(xm)

                assert_equal(r[0][0], rm[0][0])
                assert_equal(r[0][1], rm[0][1])
Ejemplo n.º 4
0
    def test_vs_nonmasked(self):
        x = np.array((-2, -1, 0, 1, 2, 3) * 4)**2
        assert_array_almost_equal(mstats.normaltest(x), stats.normaltest(x))
        assert_array_almost_equal(mstats.skewtest(x), stats.skewtest(x))
        assert_array_almost_equal(mstats.kurtosistest(x),
                                  stats.kurtosistest(x))

        funcs = [stats.normaltest, stats.skewtest, stats.kurtosistest]
        mfuncs = [mstats.normaltest, mstats.skewtest, mstats.kurtosistest]
        x = [1, 2, 3, 4]
        for func, mfunc in zip(funcs, mfuncs):
            assert_raises(ValueError, func, x)
            assert_raises(ValueError, mfunc, x)
Ejemplo n.º 5
0
 def test_skewtest_2D_notmasked(self):
     # a normal ndarray is passed to the masked function
     x = np.random.random((20, 2)) * 20.
     r = stats.skewtest(x)
     rm = stats.mstats.skewtest(x)
     assert_allclose(np.asarray(r), np.asarray(rm))