I've been reading John Maynard-Smith's classic book Evolution and the Theory of Games. One thing I've found that helps me to understand complex topics is to develop some model as I'm reading. I've developed several OWL ontologies as I was reading up on a topic just to help me get clear on various concepts. In this case I started with a wonderful Gnu tool called Octave which is a scaled down (but still very powerful) free version of MatLab and does matrix and linear algebra computations. But as I was working it occurred to me it would be much more re-usable and amenable to "what if" games if I had the info in spreadsheet format rather than in the format that Octave uses. I was surprised to see how well Excel can do matrix operations and I developed the following spread sheet which implements most of the models in Appendices A, B, and D: Evolutionary Game Theory in Excel
Appendix A shows how to calculate the payoff between two players when each player has a different payoff matrix. The payoff for player 1 is "P Payoff" and for player 2 is "Q Payoff". The strategy for player one is the column vector p and for player two the column vector q. So if p = [.3; .6; .1] it means that player 1 plays Hawk 30% of the time, Dove 60% and Retreat 10%. Note I'm using the same notation here as Octave where a ";" means a new column and a "," means another element in the same row. So the Transpose of p (denoted p') would be [.3, .6, .1].
Appendix B shows how to compute the ESS (which is also a Nash Equilibrium) for a two person game that meets the requirements in the book. That computation uses the same P Payoff matrix as for Appendix A so the computation is only valid when there are two strategies, i.e., when one strategy is dominated by another and hence can be eliminated. In the case as I've set it up in the spreadsheet Dove dominates Retreat so the formula holds. As I read further in the book I realized that R stands for Retaliate which is quite different from Retreat, however I left the spreadsheet as is because with R dominated by D the ESS formula is valid. If you change the value of R so that it is no longer dominated (e.g., to make it consistent with Retaliate) the values for the ESS won't be valid since that formula only works with two strategy games. However, it is still useful for other purposes such as to model the actual 3 strategy game Hawk, Dove, and Retaliate.
Appendix D (sheet 2, A and B are in sheet 1) shows the fitness W for a player playing a pure strategy. It also shows the mean fitness for the population based on which percent are playing which strategy (again the P Payoff matrix is used). It also computes the fitness for the next iteration of the game for each group playing the particular strategy. Note that when R is dominated by D and you compute the ESS you can play "what if" by setting the values for H and D to be different than the ESS and you will see that in the next round they are converging toward the ESS. E.g., if percentage of H is greater than the ESS and percentage of D is less than the ESS in the next iteration the percentage of H will decrease and the percentage of D will increase. This will of course continue until they reach the ESS at which point it will be stable.
I thought this spreadsheet might be useful for others trying to learn the topic as well as for people who want to start doing actual modeling. The current example has 3 strategies but it would be trivial to expand it to more. I have some ideas on altruism that I want to try out with game theory modeling and I think this spreadsheet is a good first step toward what I will need and I hope it may help others as well. Also, there is always a chance I made some error so that's another reason to post it, if anyone finds any errors please let me know by commenting or sending me an email using the email on my contact page.
Comentários