print(stats.spearmanr(a,b)) print('pointbiserialr:') print(stats.pointbiserialr(pb,l)) print(stats.pointbiserialr(apb,a)) print('kendalltau:') print(stats.kendalltau(l,m)) print(stats.kendalltau(a,b)) print('linregress:') print(stats.linregress(l,m)) print(stats.linregress(a,b)) print('\nINFERENTIAL') print('ttest_1samp:') print(stats.ttest_1samp(l,12)) print(stats.ttest_1samp(a,12)) print('ttest_ind:') print(stats.ttest_ind(l,m)) print(stats.ttest_ind(a,b)) print('ttest_rel:') print(stats.ttest_rel(l,m)) print(stats.ttest_rel(a,b)) print('chisquare:') print(stats.chisquare(l)) 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))
from stats import ttest_ind, tinv a = [62, 96, 26, 121, 106, 59, 50, 122, 114, 89, 55, 36] b = [109, 117, 73, 80, 113, 156, 24, 73, 121, 125, 37, 69] t, prob = ttest_ind(a, b, 1) print tinv(.05, 10)
from stats import ttest_ind, tinv a = [62,96,26,121,106,59,50,122,114,89,55,36] b = [109,117,73,80,113,156,24,73,121,125,37,69] t,prob = ttest_ind(a,b,1) print tinv(.05,10)
print 'pointbiserialr:' print stats.pointbiserialr(pb,l) print stats.pointbiserialr(apb,a) print 'kendalltau:' print stats.kendalltau(l,m) print stats.kendalltau(a,b) print 'linregress:' print stats.linregress(l,m) print stats.linregress(a,b) print '\nINFERENTIAL' print 'ttest_1samp:' print stats.ttest_1samp(l,12) print stats.ttest_1samp(a,12) print 'ttest_ind:' print stats.ttest_ind(l,m) print stats.ttest_ind(a,b) print 'ttest_rel:' print stats.ttest_rel(l,m) print stats.ttest_rel(a,b) print 'chisquare:' print stats.chisquare(l) 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 'pointbiserialr:' print stats.pointbiserialr(pb, l) print stats.pointbiserialr(apb, a) print 'kendalltau:' print stats.kendalltau(l, m) print stats.kendalltau(a, b) print 'linregress:' print stats.linregress(l, m) print stats.linregress(a, b) print '\nINFERENTIAL' print 'ttest_1samp:' print stats.ttest_1samp(l, 12) print stats.ttest_1samp(a, 12) print 'ttest_ind:' print stats.ttest_ind(l, m) print stats.ttest_ind(a, b) print 'ttest_rel:' print stats.ttest_rel(l, m) print stats.ttest_rel(a, b) print 'chisquare:' print stats.chisquare(l) 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('pointbiserialr:') print(stats.pointbiserialr(pb,l)) print(stats.pointbiserialr(pb,l)) print('kendalltau:') print(stats.kendalltau(l,m)) print(stats.kendalltau(l,l)) print('linregress:') print(stats.linregress(l,m)) print(stats.linregress(l,l)) print('\nINFERENTIAL') print('ttest_1samp:') print(stats.ttest_1samp(l,12)) print(stats.ttest_1samp(l,12)) print('ttest_ind:') print(stats.ttest_ind(l,m)) print(stats.ttest_ind(l,l)) print('chisquare:') print(stats.chisquare(l)) print(stats.chisquare(l)) print('ks_2samp:') print(stats.ks_2samp(l,m)) print(stats.ks_2samp(l,l)) print('mannwhitneyu:') print(stats.mannwhitneyu(l,m)) print(stats.mannwhitneyu(l,l)) print('ranksums:') print(stats.ranksums(l,m)) print(stats.ranksums(l,l)) print('wilcoxont:')
fileNameB = sys.argv[2] colNum = int(sys.argv[3]) posteriorA = [] posteriorB = [] # Read first file fileHandle = open(fileNameA,'r') for line in fileHandle: toks = line.split() posteriorA.append(float(toks[colNum])) fileHandle.close() # Read second file fileHandle = open(fileNameB,'r') for line in fileHandle: toks = line.split() posteriorB.append(float(toks[colNum])) fileHandle.close() # Perform t-test ttest_ind(posteriorA[burnIn:],posteriorB[burnIn:],printit=1,name1="Posterior1",name2="Posterior2")
reload(pstat) import statshelp print('\n\nSingle Sample t-test') x = list(map(float,[50.,75.,65.,72.,68.,65.,73.,59.,64.])) print('SHOULD BE ... t=-3.61, p<0.01 (df=8) ... Basic Stats 1st ed, p.307') stats.ttest_1samp(x,75,1) print('\n\nIndependent Samples t-test') a = list(map(float,[11.,16.,20.,17.,10.,12.])) b = list(map(float,[8.,11.,15.,11.,11.,12.,11.,7.])) print('\n\nSHOULD BE ??? <p< (df=) ... ') stats.ttest_ind(a,b,1) print('\n\nRelated Samples t-test') before = list(map(float,[11,16,20,17,10])) after = list(map(float,[8,11,15,11,11])) print('\n\nSHOULD BE t=+2.88, 0.01<p<0.05 (df=4) ... Basic Stats 1st ed, p.359') stats.ttest_rel(before,after,1,'Before','After') print("\n\nPearson's r") y = list(map(float,[8,7,7,6,5,4,4,4,2,0])) x = list(map(float,[0,0,1,1,1,2,2,3,3,4])) print('SHOULD BE -0.94535 (N=10) ... Basic Stats 1st ed, p.190',x,y)
fileNameB = sys.argv[2] colNum = int(sys.argv[3]) posteriorA = [] posteriorB = [] # Read first file fileHandle = open(fileNameA, 'r') for line in fileHandle: toks = line.split() posteriorA.append(float(toks[colNum])) fileHandle.close() # Read second file fileHandle = open(fileNameB, 'r') for line in fileHandle: toks = line.split() posteriorB.append(float(toks[colNum])) fileHandle.close() # Perform t-test ttest_ind(posteriorA[burnIn:], posteriorB[burnIn:], printit=1, name1="Posterior1", name2="Posterior2")