Created
November 9, 2020 05:39
-
-
Save theoremoon/9c2d5c16b50085479ee548b85ee6feac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def qtest(xs): | |
m = len(xs) | |
ts = [sum(x) for x in xs] | |
tbar = sum(ts) / m | |
ss = [] | |
for i in range(len(xs[0])): | |
s = 0 | |
for j in range(len(xs)): | |
s += xs[j][i] | |
ss.append(s) | |
a = sum([(ts[j] - tbar)**2 for j in range(m) ]) | |
b = sum(ss) | |
c = sum([s**2 for s in ss]) | |
numerator = m * (m-1) * a | |
denominator = m * b - c | |
print(a) | |
print(b) | |
print(c) | |
print(m) | |
return numerator/denominator | |
print(qtest([[0,0,1,1,0,0,1,0], [0,1,0,1,0,1,1,1], [0,0,1,1,1,1,1,1]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment