Example #1
0
    def Likelihood(self, data, hypo):
        """Computes the likelihood of the data under the hypothesis.

        Evaluates the Poisson PMF for lambda and k.

        hypo: elapsed time since the last train
        data: tuple of arrival rate and number of passengers
        """
        x = hypo
        lam, k = data
        like = thinkstats2.EvalPoissonPmf(k, lam * x)
        return like
Example #2
0
    def Likelihood(self, data, hypo):
        """Computes the likelihood of the data under the hypothesis.

        Evaluates the Poisson PMF for lambda and k.

        hypo: arrival rate in passengers per second
        data: tuple of elapsed_time and number of passengers
        """
        lam = hypo
        x, k = data
        like = thinkstats2.EvalPoissonPmf(k, lam * x)
        return like
 def testEvalPoissonPmf(self):
     p = thinkstats2.EvalPoissonPmf(2, 1)
     self.assertAlmostEqual(p, 0.1839397205)