-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequality_of_means.py
More file actions
40 lines (30 loc) · 1.14 KB
/
equality_of_means.py
File metadata and controls
40 lines (30 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from data.read import read_csv
from model.player import Player
from typing import List
from hypothesis.test_statistics import two_samples_mean_ll_ratio, students_z_test
significance_level = 95
def run():
t, p = two_samples_mean_ll_ratio(6, 9, 5, 3, debug=True)
print(t)
print(p)
z, p = students_z_test(6, 9, 5, 3, debug=True)
print
players: List[Player] = read_csv("training_attendance.csv", Player)
n = m = k = l = 0
for player in players:
if player.isFirstTeam():
k += player.attendances
n += player.attendances + player.absences
elif player.isSecondTeam():
l += player.attendances
m += player.attendances + player.absences
t, p = two_samples_mean_ll_ratio(n, m, k, l, debug=True)
z, p = students_z_test(n, m, k, l, debug=True)
if (100*p < (100 - significance_level)):
print("Null Hypothesis rejected at the {}% significance level".format(significance_level))
print("Means are different")
else:
print("Insufficient evidence to reject null")
if __name__ == "__main__":
print("Testing equality of means")
run()