def test_robust_skewness_3d(self, reset_randomstate): x = np.random.standard_normal(100) x = np.hstack([x, np.zeros(1), -x]) x = np.tile(x, (10, 10, 1)) sk_3d = robust_skewness(x, axis=2) result = np.zeros((10, 10)) for sk in sk_3d: assert_almost_equal(sk, result)
def test_robust_skewness_4(self, reset_randomstate): x = np.random.standard_normal(1000) x[x > 0] *= 3 m = np.median(x) s = x.std(ddof=0) expected = (x.mean() - m) / s _, _, _, sk4 = robust_skewness(x) assert_allclose(expected, sk4)
def test_robust_skewness_3d(self): x = np.random.standard_normal(100) x = np.hstack([x, np.zeros(1), -x]) x = np.tile(x, (10, 10, 1)) sk_3d = robust_skewness(x, axis=2) result = np.zeros((10, 10)) for sk in sk_3d: assert_almost_equal(sk, result)
def test_robust_skewness_symmetric(self, reset_randomstate): x = np.random.standard_normal(100) x = np.hstack([x, np.zeros(1), -x]) sk = robust_skewness(x) assert_almost_equal(np.array(sk), np.zeros(4))
def test_robust_skewness_1d_2d(self, reset_randomstate): x = np.random.randn(21) y = x[:, None] sk_x = robust_skewness(x) sk_y = robust_skewness(y, axis=None) assert_almost_equal(np.array(sk_x), np.array(sk_y))
def test_robust_skewness_1d(self): x = np.arange(21.0) sk = robust_skewness(x) assert_almost_equal(np.array(sk), np.zeros(4))
def test_robust_skewness_symmetric(self): x = np.random.standard_normal(100) x = np.hstack([x, np.zeros(1), -x]) sk = robust_skewness(x) assert_almost_equal(np.array(sk), np.zeros(4))
def test_robust_skewness_1d_2d(self): x = np.random.randn(21) y = x[:, None] sk_x = robust_skewness(x) sk_y = robust_skewness(y, axis=None) assert_almost_equal(np.array(sk_x), np.array(sk_y))