Bayes' Rule and Information Cascades

This examples demonstrates how Bayes' Rule can be used to model information cascades.

You need to simulate how a set of rational players would decide what the dominant color of balls is in an urn, if they sequentially draw a ball from the urn, look at the color of the ball and put it back in the urn without showing the ball to the other players. The player then guesses whether the urn is majority blue or majority red and publicly announces this guess to the other players. You will start with an urn with 5 balls in total, red and blue as ball colors and a distribution of red balls = 2/5 and blue balls = 3/5.

Read carefully what you need to accomplish for this exercise. You need to submit your source code.

You should simulate the following urn: 2 out of 5 balls are red, 3 out of 5 balls are blue

  1. To simulate the game, iterate over 2) 20 times.
  2. The player draws a ball from the urn. Calculate the conditional probability for the player that the urn is majority blue or majority read, given the player's draw and given what the player has heard so far. Using this conditional probability, the player makes a guess and appends her guess at the end of the guess sequence (she announces her guess to the other players aloud). In addition, append the current draw at the end of the draw sequence.
  3. Print and return the draw sequence as well as the guess sequence

Submit your source code. You will need to understand why the guess sequence differs from the draw sequence and where an information cascade has started.