diff options
author | Holden Rohrer <hr@hrhr.dev> | 2021-01-21 03:33:31 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2021-01-21 04:00:19 -0500 |
commit | 2b146b8391fd5ca9c8c70d7530ad3968721324e9 (patch) | |
tree | bba07d17b7396006f9bc717d054e68099521a3fb /py/stats.py | |
parent | 4dc09d93cc9a6df1f0a7d6b228300252192c1fc0 (diff) |
have a complete build for secondary docs, but tables and imgs not fully integrated
Diffstat (limited to 'py/stats.py')
-rw-r--r-- | py/stats.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/py/stats.py b/py/stats.py deleted file mode 100644 index b79e56f..0000000 --- a/py/stats.py +++ /dev/null @@ -1,38 +0,0 @@ -from data2 import trials -from scipy.stats import cramervonmises -from bisect import bisect_left -from random import random - -def distance(pit1, pit2): - out = ((pit2[1]-pit1[1])**2 + (pit2[0]-pit1[0])**2)**(1/2) - if (out == 0): - return 100 - else: - return out - -def cdf(a,nnsim,tup): - return [bisect_left(nnsim, x)/len(nnsim) for x in a] - -def calcpval(trialno): - size = trials[trialno].size[0] - pits = len(trials[trialno].pits) - - nnsim = [] - for j in range(10000): - curpits = [] - for k in range(pits): - curpits.append([random()*size,random()*size]) - for pit in curpits: - l = size - for pit2 in curpits: - l = min(l,distance(pit,pit2)) - nnsim.append(l) - - nnsim.sort() - - nnreal = trials[trialno].nearest_neighbor() - stat = cramervonmises(nnreal,cdf,(nnsim,())) - return stat.pvalue - -for n in range(len(trials)): - print(calcpval(n)) |