Appendix: Mathematical Details of Implementation

Main Menu           Previous Topic                                                           Next Topic

Knowledge Types and Production Functions

Knowledge Types
We used the knowledge vector of every agent to represent his properties as well as the information he has about the true concept. Here is how each component of the vector corresponds to the mathematical quantities discussed above.
Type 0 = the agent's ID
Type 1 = the agent's true, and privately known precision (i.e. p from above)
Type 2 = the public opinion about the precision of the agent.
Type 3 = probability of H given the actions of all the previous agents (i.e. qn-1 from above)
Type 4 = probability of H given the agent's private signal (i.e. rn from above)
Type 5 = the agent's decision, which could be -1 or +1 (i.e. an from above)

Production functions
Given the knowledge types as we defined them above and the mathematical rules by which they should be updated from agent to agent, here are the production functions that result. These are examples specified for agent 2. Note that Agent$0$0 contains the true concept, which is needed for the simulation of S when we compute type 4 knowledge.

Notation from the language of production functions:
self$n refers to the value of knowledge of type n for the current agent
agent$1$n refers to the same of the previous agent (in this case, agent 1)

Note that every production function for a given agent is run exactly once: type 4 (private knowledge) in the very beginning, type 3 (public knowledge) at the proper moment in the sequence, when all the previous agents have made their decisions, and type 5 (the agent's decision) after type 3 is calculated.

Type 0: ID: no production function, the ID needs to be set for every agent beforehand. This is needed for the timing of production functions described above.

Types 1 and 2: precision: again, set beforehand, as the precision values of the agent.

Type 3: qn-1: In the light of the four cases for updating q's above, here is the pseudocode and the function itself:

proceed if and only if time is id*2 = 2.
     if previous agent has more information from signal than history, or has equal information from signal and history, but decides against history,
         update historical belief according to public signal formula -probability the agent is correct based on public precision belief.
     Else if previous agent has equal information from signal and from history,
         update historical belief according to "noisy signal" formula.
     Else, do not adjust historical belief
finally, subtract , since this is the starting amount

This last case includes the situation in which an agent believed to be imprecise surprises everyone and decides against the direction of what should be a cascade. This is a zero-probability event in the Perfect Bayesian Equilibrium and one solution would be to change the belief of that agent's precision so that the action makes sense. But how much should the belief be increased? To avoid this dilemma, we instead take the cleaner solution of assuming we are dealing with a "crazy" agent who has taken a random action and so supplies us with no new information.

(if (= (time) (* self$0 2) .01) (- (if (or (< (abs (- 0.5 agent$1$3)) (- agent$1$2 0.5)) (and (= (abs (- 0.5 agent$1$3)) (- agent$1$2 0.5) 0.00001) (< (* (- agent$1$3 0.5) agent$1$5 ) 0))) (/ (* agent$1$3 (+ 0.5 (* agent$1$5 (- agent$1$2 0.5) ))) (+ (* agent$1$3 (+ 0.5 (* agent$1$5 (- agent$1$2 0.5) ))) (* (- 1 agent$1$3) (- 1 (+ 0.5 (* agent$1$5 (- agent$1$2 0.5) )))))) (if (= (abs (- 0.5 agent$1$3)) (- agent$1$2 0.5) .00001) (/ (* agent$1$3 (+ 0.5 (* 0.333333 agent$1$5 (- agent$1$2 0.5) ))) (+ (* agent$1$3 (+ 0.5 (* 0.333333 agent$1$5 (- agent$1$2 0.5) )) ) (* (- 1 agent$1$3) (- 1 (+ 0.5 (* 0.333333 agent$1$5 (- agent$1$2 0.5) )))))) agent$1$3)) 0.5) 0)

Type 4: rn: Again, from (1), we have the following pseudocode and function itself:

if time is 1, proceed.
if random number is less than precision, then we suppose agent receives correct signal,
     so type 4 is the precision if V=1, 1-precision if V=0.
vice versa for incorrect signal.

(if (= (time) 1 0.01) (+ 0.5 (* (if (< (random) self$1) 1 -1) agent$0$0 (- self$1 0.5))) 0)

Type 5: an: The agent's decision is determined by analyzing which way the public and private signals go. See statement (10).

(if (= (time) (+ 1 (* self$0 2)) 0.01) (if (< (+ self$3 self$4) 1) -1 (if (> (+ self$3 self$4) 1) 1 (if (< (random) 0.5) -1 1))) 0)

Information Infusion

The infusion of information was simulated by altering an agent to act as a public information source. This agent makes a decision based only on private information. Furthermore, its private signal is visible to future agents, so the next agent updates the public belief using this information signal in all circumstances.

                   Previous Slide                                                           Next Slide