Dungeons & Dragons Dice problem (Allen Downey)

Hello all,

I still have little experience with pymc3 but want to understand bayesian techniques better.

In Allen’s book he has an example with dice from Dungeons and Dragons, with dice with 4, 6, 8, 12, and 20 sides.
When a die is chosen at random and the throw yields a 6 it is clear that it cannot come from the 4 sided die.

I created this model
observed = [6]
with pm.Model() as dung_dragon_one_six:
p = pm.DiscreteUniform(“p”,4,20) # Don’t know to create a distribution that gives me back 4,6,8,12,20 (so I just used this distribution)
x = pm.DiscreteUniform(“x”,1,p,observed=observed)

When I plot the sample posterior it nicely shows a distribution with the peak at 6 that gradually decreases until it is lowest at 20.

But when I set observed to 20 the sample posterior is always 12.

What is my mistake here?

Regards Hans

There is a solution here in this discussion: Question about Discrete Mixture

2 Likes