def main(): [(_ignore_stat, first), (_ignore_stat, second)] = load_stats(sys.argv[1:]) # Attempt to increase robustness by dropping the outlying 10% of values. first = trim(first, 0.1) second = trim(second, 0.1) fmean = stats.mean(first) smean = stats.mean(second) p = ttest_1samp(second, fmean)[1] if p >= 0.95: # rejected the null hypothesis print(sys.argv[1], 'mean of', fmean, 'differs from', sys.argv[2], 'mean of', smean, '(%2.0f%%)' % (p * 100,)) else: # failed to reject the null hypothesis print('cannot prove means (%s, %s) differ (%2.0f%%)' % (fmean, smean, p * 100,))
def main(): [(stat, first), (stat, second)] = load_stats(sys.argv[1:]) # Attempt to increase robustness by dropping the outlying 10% of values. first = trim(first, 0.1) second = trim(second, 0.1) fmean = stats.mean(first) smean = stats.mean(second) p = 1 - ttest_1samp(second, fmean)[1][0] if p >= 0.95: # rejected the null hypothesis print sys.argv[1], 'mean of', fmean, 'differs from', sys.argv[2], 'mean of', smean, '(%2.0f%%)' % (p * 100,) else: # failed to reject the null hypothesis print 'cannot prove means (%s, %s) differ (%2.0f%%)' % (fmean, smean, p * 100,)
def main(): fig = pyplot.figure() ax = fig.add_subplot(111) data = [samples for (_ignore_stat, samples) in load_stats(sys.argv[1:])] bars = [] color = iter('rgbcmy').next w = 1.0 / len(data) xs = numpy.arange(len(data[0])) for i, s in enumerate(data): bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0]) ax.set_xlabel('sample #') ax.set_ylabel('seconds') ax.legend(bars, sys.argv[1:]) pyplot.show()