19 September 2010

The Classroom Game

For those who do not subscribe to Mankiw’s blog, here is a blog post by a Canadian economics professor.

The professor asks a math question in the class, and gives two possible answers. Students who believe the first answer is correct raise their hands. Then students who believe the second answer is correct raise theirs. To the professor’s disappointment, about 75% of the students choose the wrong answer, while only about 10% choose the right one.

In the way the response is measured, however, it may not be that 75% of students are wrong, 10% right, and 5% uncertain. A similar voting result could have been achieved when 40% are wrong, 30% are right, and the remaining 30% are uncertain.

For the simplicity of the argument, let’s suppose that all students choose to respond. A student has an incentive to choose the right answer since his answer signals his intelligence. His signal, however, depends also on how other students have answered. It doesn’t feel good to be wrong, but at least you aren’t so embarrassed if most students are wrong as well.

We can think of a game in which students first make decision based on what they believe is the right answer, and then change the decision after seeing the initial response (there might be a strategic reason why students tend to avoid the first row). A student believes that the chance that the first answer is correct is p and the chance that the second answer is correct is 1-p. His initial response will be to choose the first answer if p > 1-p and to choose the second answer if p < 1-p (if p =.5, then the student chooses either one).

Once every student made the initial response, each student will decide whether to change his response or not based on his payoff:

 

The majority of other students

A student

 

Right Answer

Wrong answer

Right answer

a

b

Wrong answer

c

d

The best case is that the student chose the right answer while the majority of the other students chose the wrong answer. The second best is to choose the right answer while others did too. The worst case is to choose the wrong answer while others chose the right one. So for all students: b > a > d > c.

The key insight is that for most students, the loss of being in the wrong minority is greater than the gain of being in the right minority. Being in the minority attracts greater attention, and thus the signal effect is magnified. To be the wrong minority, therefore, gives a strong signal of lacking intelligence. On the other hand, being in the right minority can give a strong signal of intelligence, but this signal has a negative effect of getting enmity from other students, especially in a class where grade is curved.

Let’s have an example. Peter thinks that the second answer is right, but he isn’t completely sure. For Peter, p = 0.2 and 1-p = 0.8. His payoff is as follows:

 

The majority of other students

Peter

 

Right Answer

Wrong answer

Right answer

4

6

Wrong answer

-11

0

Initially, he does not raise his hand for the first answer since 0.8 > 0.2. It happens, however, that most students have raised their hands. If he remains firm, then there is a 0.2 chance that the majority is right while he is wrong and 0.8 chance that the majority is wrong while he is right, so his expected payoff is (0.3)(-11) + (0.7)(6) = 0.9. If changes his response, then his expected payoff is (0.3)(4) + (0.7)(0) = 1.2, so he changes his mind and raises his hand for the first answer, although he doesn’t think it is correct.

The result of this is an exaggeration in the voting. A student may vote for the first answer, even if he thinks the second answer is more likely to be correct, when more than half of the class vote for the first. Conversely, a student who thinks that the first answer is correct may not vote for it if only a few other students have voted for it.

When 40% are wrong, 30% are right, and 30% are uncertain, we could expect around 55% of students to initially choose the wrong answer. This will attract more students to choose the wrong answer, especially the remaining 15% uncertain students. Depending on the level of certainty and individual payoffs, even those who are right may choose to vote for he wrong answer or hesitate to vote for the right answer. Thus, this situation can easily end up with 75% voting for the wrong answer and 10% for the right.

09 September 2010

The ‘Guess My Number’ Game

I have recently begun studying programming with Michael Dawson’s Python Programming for the Absolute Beginner. One of the practices in the book is programming ‘Guess My Number’ game, in which the player chooses an integer between 1 and 100 and the computer tries to guess that number (the game in which the role of player and computer is reversed is an easier one).  After the computer makes a guess, the player indicates whether the chosen number is higher or lower than the guess, and the computer makes a next guess until the guess is correct.

In the hindsight this was a fairly simple exercise, but it took me quite a while to figure out that I need to keep track of the lower and upper bounds in order to make a reasonable guess. So for example, if the program guesses 47 and the number is higher, then the program sets 47 as the lower bound, so its next guess will be greater than 47.

First I programmed so that the computer takes the average of the lower and upper bounds to make a guess (it drops all the decimals, so its initial guess, after taking the average of 101 and 0, is 50). For a randomly chosen number, this program will take an average of 5.8 trials and I think this is the lowest possible, but the verification will require another post.

The problem, however, is that the player will easily find out the pattern, so after playing a few games, he or she will choose the number that requires the most number of trials. For example, if the player chooses 100, then the program will always take 7 trials to make the correct guess. So once the player figure out the program’s algorithm, the program will make an average of 7 guesses before it hits the right number.

This is pretty obvious, but a formality of game theory might be helpful. The games played is sequential. There are two players, the computer and the human. The computer prefers lower average number of trials, while the human prefers the reverse. The computer’s set of strategies is algorithms of guessing; the human’s is choosing a number from 1 to 100. The game is sequential, in which the computer plays first and the human plays next (this implies that the human knows what strategy the computer chooses before he chooses the number).

So the question is: What is the best strategy for the computer? I thought that any strategy that does not involve randomness could be easily exploited by the human, so I made a second program that guesses a random value between the lower and upper bounds.

What would be the average number of trials for this second program? First I will need to determine whether the player will prefer to choose certain number over others. I am already stuck here, but my guess is that either all values have the same average number of trials or 50 has the highest one (since it has the greatest potential for fluctuations). If either were true, then we only need to calculate the average number of trials for guessing 50.

It didn’t sound too hard at first, but I was wrong. All I bothered to figure out was that the probability of guessing 50 in exactly 2 trials is 1.376% (Well, I also calculated that the chance of guessing 100 in exactly 2 trials is 5.177%, which seems to support that 50 indeed has the highest average number of trials). I was still curious enough to try 20 games and find the average number of trials to be 8.45. It seems choosing the random number does not seem to be a good strategy for the computer even for repeated games.

Is taking the median of lower and upper bounds the best strategy for the program? I still do not have a confident answer, but it seems so. One could add the complexity by allowing the computer to use a mixed strategy. For example, if for any given game there is a 80% chance that the program will use the median strategy and 20% chance the random strategy, it may change the payer’s best response to the program’s advantage.

The game can become even more complex by allowing the program to change its strategy for each game based on the player’s previous choices of the number. For example, if the player keeps choosing 100, then the program might make 100 as its initial guess the next game.

Finally, player could be allowed to lie for certain penalty. The player will then need to choose whether to lie or to be honest each turn, and the program will need some mechanism to determine the likelihood of the lying. This could in fact be an engaging strategy game, despite its seeming simplicity.