def test_kruskalwallish(self): "Testing kruskalwallish" data1 = [self.L, self.A] data2 = [self.M, self.B] data3 = [self.L, self.A] results = (3.7881409721062096, 0.15045812299265815) i = 0 for d in data1: self.EQ(stats.kruskalwallish(d, data2[i], data3[i])[i], results[i]) i += 1
def test_kruskalwallish(self): "Testing kruskalwallish" data1 = [ self.L, self.A ] data2 = [ self.M, self.B ] data3 = [ self.L, self.A ] results = (3.7881409721062096, 0.15045812299265815) i = 0 for d in data1: self.EQ( stats.kruskalwallish( d, data2[i], data3[i] )[i], results[i] ) i += 1
print(stats.chisquare(a)) print('ks_2samp:') print(stats.ks_2samp(l, m)) print(stats.ks_2samp(a, b)) print('mannwhitneyu:') print(stats.mannwhitneyu(l, m)) print(stats.mannwhitneyu(a, b)) print('ranksums:') print(stats.ranksums(l, m)) print(stats.ranksums(a, b)) print('wilcoxont:') print(stats.wilcoxont(l, m)) print(stats.wilcoxont(a, b)) print('kruskalwallish:') print(stats.kruskalwallish(l, m, l)) print(len(l), len(m)) print(stats.kruskalwallish(a, b, a)) print('friedmanchisquare:') print(stats.friedmanchisquare(l, m, l)) print(stats.friedmanchisquare(a, b, a)) print('\nANOVAs') #execfile('test_anova.py') l = list(range(1, 21)) a = N.array(l) ll = [l] * 5 aa = N.array(ll) m = list(range(4, 24))
print stats.chisquare(a) print 'ks_2samp:' print stats.ks_2samp(l,m) print stats.ks_2samp(a,b) print 'mannwhitneyu:' print stats.mannwhitneyu(l,m) print stats.mannwhitneyu(a,b) print 'ranksums:' print stats.ranksums(l,m) print stats.ranksums(a,b) print 'wilcoxont:' print stats.wilcoxont(l,m) print stats.wilcoxont(a,b) print 'kruskalwallish:' print stats.kruskalwallish(l,m,l) print len(l), len(m) print stats.kruskalwallish(a,b,a) print 'friedmanchisquare:' print stats.friedmanchisquare(l,m,l) print stats.friedmanchisquare(a,b,a) print '\nANOVAs' #execfile('test_anova.py') l = range(1,21) a = N.array(l) ll = [l]*5 aa = N.array(ll) m = range(4,24)
print '\n\nWilcoxon T' red = [540, 580, 600, 680, 430, 740, 600, 690, 605, 520] black = [760, 710, 1105, 880, 500, 990, 1050, 640, 595, 520] print '\nSHOULD BE +3.0, 0.01<p<0.05 (N=9) ... Basic Stats 1st ed, p.477-8' print stats.wilcoxont(red, black) print stats.awilcoxont(array(red), array(black)) print '\n\nKruskal-Wallis H' short = [10, 28, 26, 39, 6] medium = [24, 27, 35, 44, 58] tall = [68, 71, 57, 60, 62] print '\nSHOULD BE 9.62, p<0.01 (slightly) (df=2) ... Basic Stats 1st ed, p.478-9' print stats.kruskalwallish(short, medium, tall) print stats.akruskalwallish(array(short), array(medium), array(tall)) print '\n\nFriedman Chi Square' highman = [1, 1, 1, 1, 2, 1, 1, 1, 1, 2] shyman = [2, 3, 2, 3, 1, 3, 2, 3, 3, 1] whyman = [3, 2, 3, 2, 3, 2, 3, 2, 2, 3] print '\nSHOULD BE 9.80, p<0.01 (slightly more) (df=2) ... Basic Stats 1st ed, p.481-2' print stats.friedmanchisquare(highman, shyman, whyman) print stats.afriedmanchisquare(array(highman), array(shyman), array(whyman)) # TRY-EM-ALL print '\n\nTRY-EM-ALL !!!\n' statshelp.dopaired(red, black)
def evaluate(self, *args, **params): return _stats.kruskalwallish(*args, **params)
print '\n\nWilcoxon T' red = [540,580, 600,680,430,740, 600,690,605,520] black = [760,710,1105,880,500,990,1050,640,595,520] print '\nSHOULD BE +3.0, 0.01<p<0.05 (N=9) ... Basic Stats 1st ed, p.477-8' print stats.wilcoxont(red,black) print stats.awilcoxont(array(red),array(black)) print '\n\nKruskal-Wallis H' short = [10,28,26,39,6] medium = [24,27,35,44,58] tall = [68,71,57,60,62] print '\nSHOULD BE 9.62, p<0.01 (slightly) (df=2) ... Basic Stats 1st ed, p.478-9' print stats.kruskalwallish(short,medium,tall) print stats.akruskalwallish(array(short),array(medium),array(tall)) print '\n\nFriedman Chi Square' highman = [1,1,1,1,2,1,1,1,1,2] shyman = [2,3,2,3,1,3,2,3,3,1] whyman = [3,2,3,2,3,2,3,2,2,3] print '\nSHOULD BE 9.80, p<0.01 (slightly more) (df=2) ... Basic Stats 1st ed, p.481-2' print stats.friedmanchisquare(highman,shyman,whyman) print stats.afriedmanchisquare(array(highman),array(shyman),array(whyman)) # TRY-EM-ALL
print stats.chisquare(a) print 'ks_2samp:' print stats.ks_2samp(l, m) print stats.ks_2samp(a, b) print 'mannwhitneyu:' print stats.mannwhitneyu(l, m) print stats.mannwhitneyu(a, b) print 'ranksums:' print stats.ranksums(l, m) print stats.ranksums(a, b) print 'wilcoxont:' print stats.wilcoxont(l, m) print stats.wilcoxont(a, b) print 'kruskalwallish:' print stats.kruskalwallish(l, m, l) print len(l), len(m) print stats.kruskalwallish(a, b, a) print 'friedmanchisquare:' print stats.friedmanchisquare(l, m, l) print stats.friedmanchisquare(a, b, a) print '\nANOVAs' #execfile('test_anova.py') l = range(1, 21) a = N.array(l) ll = [l] * 5 aa = N.array(ll) m = range(4, 24)