-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatseg.py
More file actions
executable file
·92 lines (81 loc) · 3.17 KB
/
statseg.py
File metadata and controls
executable file
·92 lines (81 loc) · 3.17 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from num import *
from eg import eg
from numbers import *
from thing import thing
import time
@eg
def _different(m=512):
rseed(17)
times={}
for sd0 in range(0,10,2):
sd = sd0/5
one = lambda z: r()*z + (-1 if r() <0.5 else 1)*random.gauss(0,sd)
print("")
pops = {}
for n0 in range(0,20,2):
n = n0/10
pops[n] = thing([one(n) for _ in range(m)])
p1 = pops[1.0]
for n in sorted(pops.keys()):
print(n,end=" ")
print(" : sd = "+str(sd/10))
for f in [p1.cliffsDelta,p1.bootstrap,p1.same_CD,
p1.hedges, p1.ttest,p1.same_HT]:
name = f.__name__
for n in sorted(pops.keys()):
rseed(17)
p0 = pops[n]
time1 = time.time()
tmp = f(p0)
time2 = time.time()
times[name] = times.get(name,0) + time2 - time1
print(" * " if tmp else " ",end=" ")
print(" : ",name)
times = sorted([(v,f) for f,v in times.items()])
for v,f in times:
print(int(v)+1,"\t",1+int(v/times[0][0]),"\t",f)
"""
Output: note that everyone agrees that if
population1 is 1*population2, then they are all the same.
But as pop2 grows more/less than x*population2, then
more and more they are the same.
Also, as we increase standard deviation, it is more
likely that all the values are the same.
-----| _different |-----------------------
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 : sd = 0.0
* : cliffsDelta
* : bootstrap
* : sureSame
* * * : hedgesTest
* : ttest
* : same
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 : sd = 0.1
* * * * * : cliffsDelta
* * * : bootstrap
* * * : sureSame
* * * * * * * * : hedgesTest
* * * : ttest
* * * : same
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 : sd = 0.2
* * * * * * * * * * : cliffsDelta
* * * * : bootstrap
* * * * : sureSame
* * * * * * * * * * : hedgesTest
* * * : ttest
* * * : same
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 : sd = 0.3
* * * * * * * * * * : cliffsDelta
* * * * * : bootstrap
* * * * * : sureSame
* * * * * * * * * * : hedgesTest
* * * * : ttest
* * * * : same
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 : sd = 0.4
* * * * * * * * * * : cliffsDelta
* * * * * * * * : bootstrap
* * * * * * * * : sureSame
* * * * * * * * * * : hedgesTest
* * * * * : ttest
* * * * * : same
"""
if __name__ == "__main__": eg()