Repository navigation
Expand file tree
/
Copy pathsample_multiple_comparison.py
More file actions
executable file
·48 lines (47 loc) · 2.08 KB
/
Copy pathsample_multiple_comparison.py
File metadata and controls
executable file
·48 lines (47 loc) · 2.08 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from multiple_comparison.multiple_comparison import MultipleComparison
from collections import OrderedDict
if __name__ == '__main__':
multiple_comparison = MultipleComparison()
args = sys.argv
if len(args) is not 2:
print "python sample_comparison.py <sample_type>"
print "please choose sample type: "
print "1: chi-square test => chi-square test"
print "2: Cochran's Q test => mcnemar test"
print "3: kruskal-wallis test => mann-whitney test"
print "4: friedman test => signed test"
else:
data = OrderedDict()
if args[1] == "1":
data["A"] = [12, 10, 8]
data["B"] = [5, 7, 20]
data["C"] = [7, 6, 7]
data["D"] = [1, 3, 4]
multiple_comparison.test(data, test="chi-square", mode="holm")
elif args[1] == "2":
data["CandidateA"] = [1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
data["CandidateB"] = [1,1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0]
data["CandidateC"] = [1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,0,0,0,0]
multiple_comparison.test(data, test="cochran")
elif args[1] == "3":
data["A"] = [3.88,4.60,6.30,2.15,4.80,5.20]
data["B"] = [2.86,9.02,4.27,9.86,3.66,5.48]
data["C"] = [1.82,4.21,3.10,1.99,2.75,2.18]
multiple_comparison.test(data, test="kruskal-wallis")
elif args[1] == "4":
data["A"] = [1,5,1,5,5,4,5]
data["B"] = [2,1,2,1,4,2,4]
data["C"] = [3,3,3,4,2,1,2]
data["D"] = [5,2,4,2,3,3,3]
data["E"] = [4,4,5,3,1,5,1]
multiple_comparison.test(data, test="friedman")
else:
print "python sample_comparison.py <sample_type>"
print "please choose sample type: "
print "1: chi-square test => chi-square test"
print "2: Cochran's Q test => mcnemar test"
print "3: kruskal-wallis test => mann-whitney test"
print "4: friedman test => signed test"