def printStats(listA, t99, t95): print("----------------------") print("N = {0}".format(len(listA))) print("Mean: {0:.4f}".format(stat.mean(listA))) print("Sample stdDev: {0:.4f}".format(stat.stdDeviation(listA))) print("99% Conf Interval: [{0:.4f}, {1:.4f}]".format( *stat.confIntervalMean(t99, listA))) print("95% Conf Interval: [{0:.4f}, {1:.4f}]".format( *stat.confIntervalMean(t95, listA)))
import statistical as stat data = [1, 1.5, 2, 2.5, 1.5, 2, 2.5, 3, 2, 2.5, 3, 3.5, 2.5, 3, 3.5, 4] print("Mean: %.3f" % stat.mean(data)) print("Variance: %.3f" % stat.variance(data))
import statistical as stat import math d1 = [3, 8, 5, 7, 2, 3, 8, 1, 5, 0, 6, 2] d2 = [0, 2, 3, 1, 3, 1, 1, 5, 4, 0] print("--- Supplier 1 ---") print("Nr of datapoints: %d" %len(d1)) print("Mean: %.2f" %stat.mean(d1)) print("--- Supplier 2 ---") print("Nr of datapoints: %d" %len(d2)) print("Mean: %.2f" %stat.mean(d2)) print("--- Supplier 1 - Supplier 2 ---") print("Nr of datapoints: %d" %len(d2)) print("Mean: %.2f" %(stat.mean(d1)-stat.mean(d2)))
def printStat(data): print("Mean: " + str(stat.mean(data))) print("Var: " + str(stat.sampleVariance(data))) print("Standard Deviation: " + str(stat.stdDeviation(data))) print("Median: " + str(stat.median(data)))
import math import statistical as stat d1 = [1, 3, 2, 2, 5, 4, 4, 3, 3] d2 = [1, 2, 4, 1, 2, 5, 2, 5, 1, 5, 5, 3] print("Mean: " + str(stat.mean(d2))) print("Var: " + str(stat.sampleVariance(d2))) print("Standard Deviation: " + str(stat.stdDeviation(d2))) print(sorted(d2))