def meanDeviation(data): b = Mean.mean(data) total = 0 v = len(data) for i in data: total = total + absolute(i - b) return total / v
def variance(data): m = Mean.mean(data) total = 0 l = len(data) for i in data: total = total + (i - m)**2 return total / l
def confidenceInterv(conf, data): lngth = len(data) mean = Mean.mean(data) std_err = sem(data) high = std_err * t.ppf((1 + conf) / 2, lngth - 1) start = mean - high end = mean + high return start, end
def confidence_interval(confidence, data): ld = len(data) mn = Mean.mean(data) std_er = sem(data) high = std_er * t.ppf((1 + confidence) / 2, ld - 1) start = mn - high end = mn + high return start, end
def zscore(data, seed): n = ItemReturnType.random_num_seed(data, seed) mn = Mean.mean(data) sd = StandardDeviation.standard_deviance(data) zs = (n - mn) / sd return zs
def test_StatisticFunctions_Mean(self): self.assertEqual(2.5, Mean.mean(self.testData))
def __init__(self): self.result = Mean.mean(data)
def zscore(sd, data): X = PickSeed.pickSeed(sd, data) meanData = Mean.mean(data) sd = StandardDeviation.standardDeviation(data) z = Division.divide(X - meanData, sd) return z
def test_mean(self): mean = Mean.mean(data=self.testData) self.assertEqual(mean, 25.466666666666665)