Пример #1
0
    def test_12(self):
        twenty = 2.07, 2.14, 2.22, 2.03, 2.21, 2.03, 2.05, 2.18, 2.09, 2.14, 2.11, 2.02
        forty_five = 2.52, 2.12, 2.49, 2.03, 2.37, 2.05, 1.99, 2.42, 2.08, 2.42, 2.29, 2.01

        self.assertAlmostEqual(standard_deviation(twenty), 0.07085516597577456)
        self.assertAlmostEqual(standard_deviation(forty_five), 0.20450050011052434)
        self.assertLess(standard_deviation(twenty), standard_deviation(forty_five))
Пример #2
0
    def test_11(self):
        control = 7, 3, -4, 14, 2, 5, 22, -7, 9, 5
        treatment = -6, 5, 9, 4, 4, 12, 37, 5, 3, 3

        self.assertAlmostEqual(variance(control), 69.37777777777778)
        self.assertAlmostEqual(standard_deviation(control), 8.329332372872257)
        self.assertAlmostEqual(variance(treatment), 128.04444444444445)
        self.assertAlmostEqual(standard_deviation(treatment), 11.315672514015437)
Пример #3
0
    def test_19(self):
        samples = (2.0, 3.0, 0.3, 3.3, 1.3, 0.4, 0.2, 6.0, 5.5, 6.5, 0.2, 2.3, 1.5, 4.0, 5.9, 1.8, 4.7, 0.7, 4.5, 0.3,
                   1.5, 0.5, 2.5, 5.0, 1.0, 6.0, 5.6, 6.0, 1.2, 0.2)

        self.assertAlmostEqual(mean(samples), 2.796666666666667)
        self.assertAlmostEqual(range_(samples), 6.3)
        self.assertAlmostEqual(standard_deviation(samples), 2.2273354009905533)
Пример #4
0
    def test_18(self):
        samples = (23, 60, 79, 32, 57, 74, 52, 70, 82, 36, 80, 77, 81, 95, 41, 65, 92, 85, 55, 76, 52, 10, 64, 75, 78,
                   25, 80, 98, 81, 67, 41, 71, 83, 54, 64, 72, 88, 62, 74, 43, 60, 78, 89, 76, 84, 48, 84, 90, 15, 79,
                   34, 67, 17, 82, 69, 74, 63, 80, 85, 61)

        self.assertAlmostEqual(mean(samples), 65.48333333333333)
        self.assertAlmostEqual(median(samples), 71.5)
        self.assertAlmostEqual(standard_deviation(samples), 21.133547647240682)
Пример #5
0
    def test_7(self):
        samples = 3.4, 2.5, 4.8, 2.9, 3.6, 2.8, 3.3, 5.6, 3.7, 2.8, 4.4, 4.0, 5.2, 3.0, 4.8

        self.assertAlmostEqual(variance(samples), 0.9426666666666667)
        self.assertAlmostEqual(standard_deviation(samples), 0.9709102258533828)