## Sudden death

To compute the probability of winning in a sudden death overtime, the important statistic is not goals per game, but time until the first goal. The assumption that goal-scoring is a Poisson process implies that the time between goals is exponentially distributed.

Given `lam`

, we can compute the
time between goals like this:

lam = 3.4 time_dist = thinkbayes.MakeExponentialPmf(lam, high=2, n=101)

`high`

is the upper bound of the
distribution. In this case I chose 2, because the probability of going
more than two games without scoring is small. `n`

is the number of values in the Pmf.

If we know `lam`

exactly, that’s
all there is to it. But we don’t; instead we have a posterior distribution
of possible values. So as we did with the distribution of goals, we make a
meta-Pmf and compute a mixture of Pmfs.

def MakeGoalTimePmf(suite): metapmf = thinkbayes.Pmf() for lam, prob in suite.Items(): pmf = thinkbayes.MakeExponentialPmf(lam, high=2, n=2001) metapmf.Set(pmf, prob) mix = thinkbayes.MakeMixture(metapmf) return mix

Figure 7-3 shows the resulting distributions. For time values less than one period (one third of a game), the Bruins are more likely to score. The time until the Canucks score is more likely to be longer.

I set the number of values, `n`

, fairly high in order to minimize the number of ties, since it is not possible for ...

Get *Think Bayes* now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.