@@ 43-55 (lines=13) @@ | ||
40 | sample_size = 29 |
|
41 | sampling_distribution = MeanSamplingDistribution(sample_mean=sample_mean, sample_sd=sample_sd, |
|
42 | sample_size=sample_size) |
|
43 | self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.student_t) |
|
44 | print('sampling distribution: (point_estimate = ' + str(sampling_distribution.point_estimate) |
|
45 | + ', standard_error = ' + str(sampling_distribution.standard_error) + ')') |
|
46 | print('confidence interval for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95))) |
|
47 | ||
48 | def test_confidence_interval_with_sample_student(self): |
|
49 | mu = 0.0 |
|
50 | sigma = 1.0 |
|
51 | sample_size = 29 |
|
52 | sample = Sample() |
|
53 | ||
54 | for i in range(sample_size): |
|
55 | sample.add_numeric(normal(mu, sigma)) |
|
56 | ||
57 | sampling_distribution = MeanSamplingDistribution(sample_distribution=SampleDistribution(sample)) |
|
58 | self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.student_t) |
|
@@ 20-32 (lines=13) @@ | ||
17 | self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.normal) |
|
18 | print('sampling distribution: (point_estimate = ' + str(sampling_distribution.point_estimate) |
|
19 | + ', standard_error=' + str(sampling_distribution.standard_error) + ')') |
|
20 | print('confidence interval for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95))) |
|
21 | ||
22 | def test_confidence_interval_with_sample_normal(self): |
|
23 | mu = 0.0 |
|
24 | sigma = 1.0 |
|
25 | sample_size = 31 |
|
26 | sample = Sample() |
|
27 | ||
28 | for i in range(sample_size): |
|
29 | sample.add_numeric(normal(mu, sigma)) |
|
30 | ||
31 | sampling_distribution = MeanSamplingDistribution(sample_distribution=SampleDistribution(sample)) |
|
32 | self.assertEqual(sampling_distribution.distribution_family, DistributionFamily.normal) |
|
33 | print('sampling distribution: (point_estimate = ' + str(sampling_distribution.point_estimate) |
|
34 | + ', standard_error = ' + str(sampling_distribution.standard_error) + ')') |
|
35 | print('confidence interval for 95% confidence level: ' + str(sampling_distribution.confidence_interval(0.95))) |