The task

The following question is from a Basic Statistics course on Coursera:

In a shop, people can take chewing gum from a dispenser on the right, or the left. The dispenser on the right has 7 packets of mint gum, and 3 packets of fruit gum, and the dispenser on the left has 7 packets of mint gum and 7 packets of fruit gum.

Someone buys a packet of mint gum - what is the probability that they took this packet from the right dispenser?

You are required to calculate the following:

  • P(mint | right)
  • P(right)
  • P(mint)

And then apply Bayes law to find P(right | mint).

My initial thinking

My initial approach was to create a data matrix, convert to probabilities (divide by 24 - total number of packets) and simply use joint and marginal probabilities.

The solution

But the answer provided is:

  • P(mint | right) = 7/10 (clearly ignore the left dispenser)
  • P(right) = 0.5 (clearly assuming there is 50/50 chance between dispensers)
  • P(mint) = 14/24 (seem to be making use of 24 packets, ie marginal of both right and left dispensers)

Mixed approach?

I can kind of understand why P(mint | right) = 7/10.

I can also (kind of) understand why there's 50/50 chance for dispenser selection.

But the two seem to be based on dispenser-based probabilities rather then packet probabilities.

So how come that we use 24 (total amount of packets) when calculating P(mint)?

It seems that sometimes a dispenser-based approach is taken, sometimes a packet-based approach.

Does it smell?

Finally, am I wrong to feel this is not the greatest of questions?


p(mint | right) = 7/10 assumes that the packets are somehow shuffled in the dispenser. p(right) = 0.5 is also just an assumption. I think the question should have stated these assumptions more clearly. Both of these may or may not be good assumptions in the real world. But, in the absence of further information, it does make sense to assume them because any other choice would impose even further assumptions, which wouldn't be justified. For example, p(right) may not be equal to 0.5 in the real world (e.g. left and right handed people might behave differently). But, without knowing this specifically, we should choose the distribution that's consistent with our knowledge, but otherwise imposes the least structure. In this case, it's a uniform distribution over {left, right} because we know nothing. To choose any other distribution would be to impose further assumptions that are not justified by our current knowledge. For more information about this reasoning, see principle of indifference and principle of maximum entropy.

I don't think the answer 14/24 is correct for p(mint).

Let $D$ denote dispenser, which can be $\text{Left}$ or $\text{Right}$. Let $G$ denote gum, which can be $\text{Fruit}$ or $\text{Mint}$.

Assume the following:

  • $p(D=\text{Right}) = 0.5$ (as given in answer)
  • $p(D=\text{Left}) = 0.5$ (as a consequence)
  • $p(G=\text{Mint} \mid D=\text{Right}) = 0.7$ (as given in answer)
  • $p(G=\text{Mint} \mid D=\text{Left}) = 0.5$ (using the same reasoning)

The marginal distribution $p(G)$ is obtained by summing the joint distribution $p(G, D)$ over $D$. If we specify that the gum is mint:

$$p(G=\text{Mint}) = \sum_{D \in \{\text{Left, Right}\}} p(G=\text{Mint}, D)$$

Use the chain rule (i.e. definition of conditional probability):

$$p(G=\text{Mint}) = \sum_{D \in \{\text{Left, Right}\}} p(G=\text{Mint} \mid D) p(D)$$

Expand the sum:

$$p(G=\text{Mint}) = p(G=\text{Mint} \mid D=\text{Left}) p(D=\text{Left}) + p(G=\text{Mint} \mid D=\text{Right}) p(D=\text{Right})$$

Plug in our known values:

$$p(G=\text{Mint}) = 0.5 \cdot 0.5 + 0.7 \cdot 0.5 = 0.6$$

Equivalent argument, using simulation:

Imagine 1 million people buy gum in the same circumstances (with the order of gum in the dispensers shuffled randomly each time). Half choose left and half choose right so, on average, 500,000 people choose right and 500,000 people choose left. Consider the people who choose right. p(mint | right) = 0.7 so, on average, 350,000 of these people buy mint. Consider the people who choose left. p(mint | left) = 0.7 so, on average, 250,000 of these people buy mint. Adding these numbers up, 600,000 out of 1,000,000 people buy mint. So, p(mint) = 0.6.

Rather, 14/24 is correct answer for the probability that the right dispenser was chosen, given that mint gum was bought (i.e. the answer to the 'main' question). Use Bayes rule:

$$ p(D=\text{Right} \mid G=\text{Mint}) = \frac{ p(G=\text{Mint} \mid D=\text{Right}) p(D=\text{Right}) }{ p(G=\text{Mint}) } $$

Plug in our values from above:

$$p(D=\text{Right} \mid G=\text{Mint}) = \frac{0.7 \cdot 0.5}{0.6} = \frac{14}{24}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.