# Updating the parameters of a Beta distribution in a “real life” situation

I know this is a contrived example but I am trying to understand how to use Bayesian statistics and I need your help with my doubts.

Let's say I am visiting an island where I know there are a million people and 99% of these people are "Good" while the remaining 10,000 are "Bad". I try to understand if the people I meet are Good or Bad but Good people don't do anything in particular when I meet them. I hold the belief that if a person I meet tries to punch me, he's probably a Bad person, with a probability of 70%, while if he tries to kill me, he's a Bad person with a 90% probability. The fact is, since it is the first time I visit this island, I am not perfectly sure about these estimates of mine.

So, whenever I meet a person for the first time, I start by considering for my belief about him a Beta Distribution, B(1,99) for the probability that this person is Bad. This distribution is peaked around 0.01 (Mode) and I guess it correctly describes a person I still don't know as probably Good.

After interacting with this newly met person, if he didn't do anything, I have no reason to update my belief about him being good or bad (right?) but unfortunately, this person does try to kill me!

My question is: how do I know how to update the parameters of the Beta Distribution to reflect this new knowledge? I expect the new parameters to be something like B(90,10), so that the Mode is now approximately 0.9. But how do I know it is B(90,10) and not B(9,1) or B(18,2) or B (900,100)?

After escaping from this guy, I try to be more careful, but the day after I meet him again and he tries to punch me! Now I should take into consideration the fact that punching isn't as strong a hint as killing but still it does confirm that this person is probably bad. How do I update my belief now? I would expect to obtain another Beta distribution that is somehow larger and with a lower peak.

## 1 Answer

You're looking at the probabilities the wrong way around. You need to know the probability that the person will do nothing / hit / kill you if he's good and if he's bad; your objective is to figure out the probability that the person is bad depending on the action he takes. What you have done is specify this latter probability ("if a person I meet tries to punch me, he's probably a Bad person, with a probability of 70%") so at that point there's nothing left to calculate, because you've already said that the probability that they are a bad person is 70% if they try to punch you.

Here's how you can work it out, with some made-up information filling in the missing pieces. Let's start out by describing the probabilities of good / bad people taking different actions, using numbers somewhat similar to those of the problem statement:

\begin{align} p(\text{nothing}|\text{good}) &=& 1 \\ p(\text{hit}|\text{good}) = p(\text{kill}|\text{good}) &=& 0 \\ p(\text{nothing}|\text{bad}) &=& 0.1 \\ p(\text{hit}|\text{bad}) &=& 0.7 \\ p(\text{kill}|\text{bad}) &=& 0.2 \\ \end{align}

Now we'll construct an arbitrary prior on the person being good; we can use the information given in the question to specify $p(\text{good}) = 0.99$ and conversely $p(\text{bad}) = 0.01$, as 99% of the people on the island are good, so the probability that any individual you meet is good is $0.99$. (Note that we don't need to put a distribution on the probabilities, we are going to update them directly.) If we meet someone and they try to hit us, what is the probability that they are bad?

$$p(\text{bad}|\text{hit}) = {p(\text{hit}|\text{bad}) \cdot p(\text{bad}) \over p(\text{hit}|\text{bad}) \cdot p(\text{bad}) + p(\text{hit}|\text{good}) \cdot p(\text{good})}$$

We can avoid any calculation at all by noting that, in this case, $p(\text{hit}|\text{good}) = 0$, so the right hand side will equal $1$ regardless of what the prior $p(\text{bad})$ is. This makes sense, because only bad people try to hit you; if someone does, you know right away they must be bad. Clearly this works the same way for finding $p(\text{bad}|\text{kill})$.

Now for the other case; what if the person does not try to hit you? We have:

\begin{align}p(\text{bad}|\text{nothing}) &= {p(\text{nothing}|\text{bad}) \cdot p(\text{bad}) \over p(\text{nothing}|\text{bad}) \cdot p(\text{bad}) + p(\text{nothing}|\text{good}) \cdot p(\text{good})} \\ &= {0.1 \cdot 0.01 \over 1 \cdot 0.99 + 0.1 \cdot 0.01} \\ &= 0.0011 \end{align}

If the person does nothing, this reduces the probability that they are bad from $0.01$ to $0.0011$.

If you run into this person again, you'd use the probabilities $p(\text{bad}) = 0.0011$ and $p(\text{good}) = 0.9989$ as your new prior probabilities in subsequent calculations ("yesterday's posterior is today's prior"), but otherwise, the calculations would proceed in the same way as above.

• Thank you for your answer Ben, and sorry for the very late reply. I have been put on something completely different for a long while. I understand your explanation and it seems to describe what I know (not much) of Bayes theorem and its basic application. I guess I am actually trying to do something different that appears as "the wrong way around". As soon as I can I will try to come back to this to better explain what I am looking for. Once again, thank you for your time and the very clear explanation. – Johannes Wentu Sep 7 '18 at 8:30