def MarginError(data): List = [] SE = (StdDevSample(data) / (squareRoot(len(data)))) for i in Z_scores(z_values(data)): ME = i * SE List.append(ME) return List
def Sample_Correlation(list1, list2): n = len(list1) avg_x = average(list1) avg_y = average(list2) rod = 0 x2 = 0 y2 = 0 for i in range(n): x = subtraction(list1[i], avg_x) y = subtraction(list2[i], avg_y) rod += product(x, y) x2 += square(x) y2 += square(y) return rod / squareRoot(x2 * y2)
def SquareRoot(self, a): if typeFunction(a) == True: self.result = squareRoot(a) return self.result
def test_squareRoot(self): self.assertEqual(5, squareRoot(25))
def population_variance(data): x = StdDevPop(data) return squareRoot(x)
def sample_variance(data): x = StdDevSample(data) return squareRoot(x)