# Segment 2: Daniel Shepard

### Problems

#### To Calculate

1. If the knight had captured a Gnome instead of a Troll, what would his chances be of crossing safely?

Solution:

By capturing a gnome, the only safe hypothesis remains . Bayes rule can be applied to obtain the probability of given that a gnome was captured, , as follows

2. Suppose that we have two identical boxes, A and B. A contains 5 red balls and 3 blue balls. B contains 2 red balls and 4 blue balls. A box is selected at random and exactly one ball is drawn from the box. What is the probability that it is blue? If it *is* blue, what is the probability that it came from box B?

Solution:

To determine the probability that the ball drawn is blue, , we must consider two possibilities that are equally probable, we drew from box A, , or we drew from box B, . Therefore, the probability that the ball is blue is

Given that the ball is blue, we can determine the probability that it was drawn from box B using Bayes rule as follows

#### To Think About

1. Do you think that the human brain's intuitive "inference engine" obeys the commutativity and associativity of evidence? For example, are we more likely to be swayed by recent, rather than older, evidence? How can evolution get this wrong if the mathematical formulation is correct?

The human brain's "inference engine" does not obey commutativity and associativity of evidence. People often develop such a firm belief in certain things that no matter how much evidence to the contrary is presented it will not sway them. I believe that this is largely due to higher-level risk analysis. Oftentimes, there is a certain risk in changing your viewpoint on something. This risk could be physical, social, or even imagined because of pride. Due to this perceived risk in changing your mind, people often heavily de-weight or even ignore new evidence presented to them. I don't think that evolution "got this wrong". There is just an additional layer of logic on top of the "inference engine" that aids in some cases and hurts in others. This type of behavior can be connected, in some cases, to instinctive behavior, which is not based on evidence and cannot be swayed by evidence.

2. How would you simulate the Knight/Troll/Gnome problem on a computer, so that you could run it 100,000 times and see if the Knights probability of crossing safely converges to 1/3?

Solution:

For each trial, I would first randomly choose , , or based on the likelihood ratio . This can be done by dividing a uniform distribution into bins with sizes according to the likelihood ratio. Then, I would simulate what the knight caught using the troll to gnome ratios , , and for , , and , respectively, based on that trial's hypothesis. Finally, I would determine the percentage of cases where the knight caught a troll that the correct hypothesis was . The following MATLAB code performs this simulation:

N = 100000; r1 = rand(N,1); H = zeros(N,1); HBounds = [0 0.2;0.2 0.4;0.4 1]; for(i = 1:3) H(r1 > HBounds(i,1) & r1 <= HBounds(i,2)) = i; end r2 = rand(N,1); Creature = zeros(N,1); CBounds(1,:,:) = [0 0.4;0.4 1]; CBounds(2,:,:) = [0 0.2;0.2 1]; CBounds(3,:,:) = [0 0;0 1]; for(i = 1:2) Creature(r2 > squeeze(CBounds(H,i,1)) ... & r2 <= squeeze(CBounds(H,i,2))) = i; end P = sum(Creature == 1 & H == 2)/sum(Creature == 1)

3. Since different observers have different background information, isn't Bayesian inference useless for making social decisions (like what to do about climate change, for example)? How can there ever be any consensus on probabilities that are fundamentally subjective?

It is true that there are some decisions that are fundamentally subjective and a consensus between people, having multiple perspectives, may not be possible. An example of which is someone's favorite movie. Suppose person A hates a certain movie that is person B's favorite movie. No matter how much evidence person B tries to give attesting to the quality of the movie, person A will likely still hate the movie. However, this does not mean that Bayesian inference is useless. Bayesian inference can be used the examine a persons beliefs and project what they might think of other things. Continuing with the movie example, Netflix has put significant effort into algorithms which analyze what movies you have watch, how you rate those movies, and what other people who like movies you liked have watched to determine other movies that you might want to watch in the future. Therefore, Bayesian inference is useful for predicting behavior and opinions based on prior evidence about the individual and even other individuals with similar opinions.