def cochran(sd, data, rnge): z = Zscore.zscore(sd, data) p = PopulationProportion.proportion(sd, data, rnge) e = MarginError.marginError(sd, data) q = 1 - p cochran = (Exponentiation.power(z, 2) * p * q) / Exponentiation.power( e, 2) return cochran
def sampleSize(sd, data): e = MarginError.marginError(sd, data) stdDev = StandardDeviation.standardDeviation(data) val = (1.96 * stdDev) / e sample = Exponentiation.power(val, 2) return sample
def sampleSize(sd, data, percentage): z = Zscore.zscore(sd, data) e = MarginError.marginError(sd, data) p = percentage q = 1 - p val = z / e sample = Exponentiation.power(val, 2) * p * q return sample
def test_MathOperations_exponentiation(self): self.assertEqual(8, Exponentiation.power(2, 3))
def test_MathOperations_exponentiation(self): Exponentiation.power(2, 2) self.assertEqual(4, Exponentiation.power(2, 2))
def Power(a, b): return Exponentiation.power(a, b)
def Power(self, a, b): self.Result = Exponentiation.power(a, b) return math.pow(a, b)
def test_MathOperations_Exponentiation(self): self.assertEqual(16, Exponentiation.power(4, 2))
def Power(self, a, b): self.Result = Exponentiation.power(a, b)