def testEvalNormalCdf(self): p = thinkstats2.EvalNormalCdf(0) self.assertAlmostEqual(p, 0.5) p = thinkstats2.EvalNormalCdf(2, 2, 3) self.assertAlmostEqual(p, 0.5) p = thinkstats2.EvalNormalCdf(1000, 0, 1) self.assertAlmostEqual(p, 1.0) p = thinkstats2.EvalNormalCdf(-1000, 0, 1) self.assertAlmostEqual(p, 0.0) x = thinkstats2.EvalNormalCdfInverse(0.95, 0, 1) self.assertAlmostEqual(x, 1.64485362695) x = thinkstats2.EvalNormalCdfInverse(0.05, 0, 1) self.assertAlmostEqual(x, -1.64485362695)
def Percentile(self, p): """Inverse CDF of p. p: percentile rank 0-100 """ return thinkstats2.EvalNormalCdfInverse(p / 100, self.mu, self.sigma)