def cochran(data, seeds, nums): ZScore = Zsc.zsc(seeds,data) pp = PopulationProportion.populationPorportion(seeds, nums, data) MarOfError = MarginOfError.marginOfError(seeds, data) sub = Subtraction.difference(1, pp) cochran = (Exponential.exponential(ZScore, 2) * pp * sub) / Exponential.exponential(MarOfError, 2) return cochran
def cochran(data, seeds, nums): z_score = Z_score.z_score(seeds, data) prop = PopProportion.popProportion(seeds, nums, data) marginError = MarginOfError.marginOfError(seeds, data) diff = Subtraction.difference(1, prop) return (Exponent.power(z_score, 2) * prop * diff) / Exponent.power( marginError, 2)
def unknownPopulationStdev(seed, data, percent): ZScore = Zsc.zsc(seed, data) MarOfError = MarginOfError.marginOfError(seed, data) p = percent q = Subtraction.difference(1, p) pq = Division.division(ZScore, MarOfError) samplePopulation = Exponential.exponential(pq, 2) * p * q return samplePopulation
def unknownPopStdDev(seed, data, percent): z_score = Z_score.z_score(seed, data) marginError = MarginOfError.marginOfError(seed, data) x = percent y = Subtraction.difference(1, x) xy = Division.quotient(z_score, marginError) sample = Exponent.power(xy, 2) * x * y return sample
def test_MathOperations_subtraction(self): self.assertEqual(-1, Subtraction.difference(1, 2))
def Difference(self, a, b): self.Result = Subtraction.difference(a, b) return self.Result
def medianskewness(data): ni = (Subtraction.difference(Mean.mean(data), Median.median(data))) nii = Division.division(ni, Stddev.stddev(data)) return nii
def modeskewness(data): n = (Subtraction.difference(Mean.mean(data), Mode.mode(data))) nn = Division.division(n, Stddev.stddev(data)) return nn
def test_calculator_subtraction(self): self.assertEqual(-1, Subtraction.difference(1, 2))
def test_MathOperations_diff_list(self): sublist = [8, 4, 2] self.assertEqual(2, Subtraction.difference(sublist))
def Difference(a, b): return Subtraction.difference(a, b)
def test_MathOperations_Subtraction(self): self.assertEqual(-3, Subtraction.subtract(1, 4))
def Subtract(self, a, b): self.Result = Subtraction.subtract(a, b) return self.Result