Exemplo n.º 1
0
 def test__pooled_std__variances_differ_too_much_error(self):
     """ Warning raised when variances differ too much. """
     with warnings.catch_warnings(record=True) as w:
         statx.pooled_std(0.25, 4, 0.5, 4)
         self.assertEqual(len(w), 1)
         self.assertTrue(issubclass(w[-1].category, UserWarning))
         self.assertTrue('variances differ' in str(w[-1].message))
Exemplo n.º 2
0
 def test__pooled_std__variances_differ_too_much_error(self):
     """ Warning raised when variances differ too much. """
     with warnings.catch_warnings(record=True) as w:
         statx.pooled_std(0.25, 4, 0.5, 4)
         self.assertEqual(len(w), 1)
         self.assertTrue(issubclass(w[-1].category, UserWarning))
         self.assertTrue('variances differ' in str(w[-1].message))
Exemplo n.º 3
0
    def test__pooled_std__computation(self):
        """ Result of pooled_std() equals expected result. """
        # Define subset of data for test
        sbp = self.metrics.loc['systolic_bp', :]
        # Computation of pooled standard deviation
        result1 = statx.pooled_std(sbp.men.s, sbp.men.n, sbp.women.s, sbp.women.n)
        # Checking if result1 is correct
        self.assertAlmostEqual(result1, 19, 1)

        # Computation of pooled standard deviation
        result2 = statx.pooled_std(9.7, 6, 12.0, 4)
        # Checking pooled_std() on small sample subset
        self.assertAlmostEqual(result2, 10.6, 1)
Exemplo n.º 4
0
    def test__pooled_std__computation(self):
        """ Result of pooled_std() equals expected result. """
        # Define subset of data for test
        sbp = self.metrics.loc['systolic_bp', :]
        # Computation of pooled standard deviation
        result1 = statx.pooled_std(sbp.men.s, sbp.men.n, sbp.women.s, sbp.women.n)
        # Checking if result1 is correct
        self.assertAlmostEqual(result1, 19, 1)

        # Computation of pooled standard deviation
        result2 = statx.pooled_std(9.7, 6, 12.0, 4)
        # Checking pooled_std() on small sample subset
        self.assertAlmostEqual(result2, 10.6, 1)