Code Duplication    Length = 15-15 lines in 2 locations

tests/stats/distribution_unit_test.py 2 locations

@@ 100-114 (lines=15) @@
97
              + ', standard_error = ' + str(sampling_distribution.standard_error) + ')')
98
        print('confidence level for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95)))
99
100
    def test_confidence_interval_with_sample_simulation(self):
101
        sample = Sample()
102
103
        for i in range(10):
104
            if random() <= 0.6:
105
                sample.add_category("OK")
106
            else:
107
                sample.add_category("CANCEL")
108
109
        sampling_distribution = ProportionSamplingDistribution(sample_distribution=SampleDistribution(sample,
110
                                                                                                      categorical_value="OK"))
111
        self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.simulation)
112
        print('sampling distribution: (point_estimate = ' + str(sampling_distribution.point_estimate)
113
              + ', standard_error = ' + str(sampling_distribution.standard_error) + ')')
114
        print('confidence level for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95)))
115
116
117
if __name__ == '__main__':
@@ 74-88 (lines=15) @@
71
              + ', standard_error = ' + str(sampling_distribution.standard_error) + ')')
72
        print('confidence level for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95)))
73
74
    def test_confidence_interval_with_sample_normal(self):
75
        sample = Sample()
76
77
        for i in range(100):
78
            if random() <= 0.6:
79
                sample.add_category("OK")
80
            else:
81
                sample.add_category("CANCEL")
82
83
        sampling_distribution = ProportionSamplingDistribution(sample_distribution=SampleDistribution(sample,
84
                                                                                                      categorical_value="OK"))
85
        self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.normal)
86
        print('sampling distribution: (point_estimate = ' + str(sampling_distribution.point_estimate)
87
              + ', standard_error = ' + str(sampling_distribution.standard_error) + ')')
88
        print('confidence level for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95)))
89
90
    def test_confidence_interval_with_sample_stats_simulation(self):
91
        sample_proportion = 0.6