Interactively
Solving Repeated Games
|
| Documentation: | Interactively Solving Repeated Games: A Toolbox.pdf | |
| Package Binaries for Windows (32 Bit): | skUtils.zip | repgames.zip |
| Package Sources: | skUtils.tar.gz | repgames.tar.gz |
| Examples: | Part I Games with Perfect Monitoring | |
| Part II Games with Imperfect Public Monitoring | ||
| Download R: | R CRAN | |
Short Example 1: Collusion with Optimal Penal Codes vs Grim-Trigger Strategies in a simple Cournot Model<\p>
# Solving Abreu's (1988) Cournot Game with Transfers for all Discount Factors # Load package library(repgames,warn.conflicts=FALSE) # Define Payoff Matrices for player 1 and 2 #L #M #H g1 = rbind(c( 10, 3, 0), # L c( 15, 7, -4), # M c( 7, 5,-15)) # H g2 = t(g1) # Initialize game m = init.game(g1=g1,g2=g2,lab.ai=c("L","M","H"), name="Simple Cournot Game", symmetric=FALSE) # Solve game (optimal penal codes) m = solve.game(m, keep.only.opt.rows=TRUE) # Solve game (grim-trigger strategies) m.gt = set.to.grim.trigger(m) m.gt = solve.game(m.gt) # Compare maximal collusive payoffs of optimal penal codes and grim-trigger plot.compare.models(m,m.gt,xvar="delta",yvar="Ue", legend.pos="topleft",m1.name = "optimal penal", m2.name="grim-trigger", main="Collusive Payoffs: Optimal Penal Codes vs Grim-Trigger")![]()
Short Example 2: Maximum Payoffs in a Repeated Noisy Prisoner's Dilemma Game<\p>
library(repgames) init.noisy.pd.game = function(d,s,lambda,mu,alpha,beta,psi) { store.objects("init.noisy.pd.game") # restore.objects("init.noisy.pd.game") # Payoff matrix of player 1 (that of player 2 is symmetric) g1 = matrix(c( 1, -s, 1+d, 0),2,2,byrow=TRUE) lab.ai = c("C","D") # Create phi.mat, which stores the signal distributions prob.yC = c(1-2*alpha-lambda, 1-2*alpha-lambda-mu-beta, 1-2*alpha-lambda-mu-beta, 1-psi) phi.mat = matrix(c( #CC CD DC DD prob.yC, #yC lambda, lambda+mu, lambda+mu , psi, #yD alpha, alpha, alpha+beta, 0, #y1 alpha, alpha+beta, alpha , 0 #y2 ), 4,4,byrow=TRUE) lab.y = c("yC","yD","y1","y2") m=init.game(g1=g1,phi.mat=phi.mat, symmetric=TRUE, lab.ai = lab.ai,lab.y=lab.y, name="Noisy PD") m } d=1;s=1.5;lambda=0.1;mu=0.2;alpha=0.1;beta=0.2;psi = 1 m = init.noisy.pd.game(d,s,lambda,mu,alpha,beta,psi) m = solve.game(m)plot(m,xvar="delta",delta.seq=seq(0.5,1,by=0.001), yvar=c("Ue","V"),lwd=2,main="Highest and Lowest PPE Payoffs in Noisy Prisoner's Dilemma")![]()