@@ 31-47 (lines=17) @@ | ||
28 | ||
29 | class MeanTestingUnitTest(unittest.TestCase): |
|
30 | ||
31 | def test_mean_normal(self): |
|
32 | mu = 0.0 |
|
33 | sigma = 1.0 |
|
34 | sample_size = 31 |
|
35 | sample = Sample() |
|
36 | ||
37 | for i in range(sample_size): |
|
38 | sample.add_numeric(normal(mu, sigma)) |
|
39 | ||
40 | sampling_distribution = MeanSamplingDistribution(sample_distribution=SampleDistribution(sample)) |
|
41 | testing = MeanTesting(sampling_distribution=sampling_distribution, mean_null=0.0) |
|
42 | ||
43 | print('one tail p-value: ' + str(testing.p_value_one_tail)) |
|
44 | print('two tail p-value: ' + str(testing.p_value_two_tail)) |
|
45 | reject_one_tail, reject_two_tail = testing.will_reject(0.01) |
|
46 | print('will reject mean = 0 (one-tail) ? ' + str(reject_one_tail)) |
|
47 | print('will reject mean = 0 (two-tail) ? ' + str(reject_two_tail)) |
|
48 | ||
49 | ||
50 | if __name__ == '__main__': |
|
@@ 10-26 (lines=17) @@ | ||
7 | from pysie.stats.samples import Sample, SampleDistribution |
|
8 | ||
9 | ||
10 | def test_mean_student(): |
|
11 | mu = 0.0 |
|
12 | sigma = 1.0 |
|
13 | sample_size = 29 |
|
14 | sample = Sample() |
|
15 | ||
16 | for i in range(sample_size): |
|
17 | sample.add_numeric(normal(mu, sigma)) |
|
18 | ||
19 | sampling_distribution = MeanSamplingDistribution(sample_distribution=SampleDistribution(sample)) |
|
20 | testing = MeanTesting(sampling_distribution=sampling_distribution, mean_null=0.0) |
|
21 | ||
22 | print('one tail p-value: ' + str(testing.p_value_one_tail)) |
|
23 | print('two tail p-value: ' + str(testing.p_value_two_tail)) |
|
24 | reject_one_tail, reject_two_tail = testing.will_reject(0.01) |
|
25 | print('will reject mean = 0 (one-tail) ? ' + str(reject_one_tail)) |
|
26 | print('will reject mean = 0 (two-tail) ? ' + str(reject_two_tail)) |
|
27 | ||
28 | ||
29 | class MeanTestingUnitTest(unittest.TestCase): |