gt_bimatrix: Payoff Matrix

Description Usage Arguments Examples

View source: R/gt_bimatrix.R

Description

This function helps you plot a payoff matrix and identify pure strategy Nash equilibria. Used for two player normal form games and finite, though possibly different, strategy sets. Credit for base code: Neelanjan Sircar

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
gt_bimatrix(X = matrix(c(1, 0, 0, 1), 2), Y = t(X), P1 = "Player 1",
  P2 = "Player 2", labels1 = NULL, labels2 = NULL, labelsize = NULL,
  arrow1 = TRUE, arrow2 = arrow1, arrow1col = gray(0.4),
  arrow2col = arrow1col, width1 = 3, width2 = width1, arrowdist = 0.2,
  alength = 0.25, space = max(arrowdist, radius + 0.075), nash = TRUE,
  radius = 0.2, starfill = "red", starborderlwd = 1.5, tips = 8,
  nashborder = "black", tfont = NULL, pty = "s", asp = NULL,
  srt1 = 90, srt2 = 0, mar = c(0.7, 0.7, 0.7, 0.7),
  matrixfill = gray(0.7), pcol1 = "black", pcol2 = pcol1,
  numcol1 = pcol1, numcol2 = pcol2, scol1 = pcol1, scol2 = pcol2,
  col.main = "red", bordercol = "white", gameborder = TRUE,
  borderdim = NULL, lwd = 1.5, offset1 = c(0.8, 0.8), offset2 = c(0.2,
  0.2), u = NULL, playersize = NULL, labelsdim = NULL, pdim = NULL,
  tscale = 1, maincex = 1, main = "", mainline = -0.5)

Arguments

X

Payoff matrix for player 1. Defaults to coordination.

Y

Payoff matrix for player 2. Defaults to coordination.

P1

name of player 1 (row)

P2

Name of player 2 (column)

labels1

Names of strategies for player 1

labels2

Names of strategies for player 2

labelsize

Size of labels

arrow1

draw response arrows for player 1

arrow2

draw response arrows for player 2

arrow1col

color of best response arrows; same for arrow2col

width1

Width of arrows; same for width2

alength

length of arrow head, defaults to .25

nash

mark the Nash equilibrium, if there are any

Examples

1
2
3
4
5
6
7
M1 <- matrix(1:12, 3, 4)
gt_bimatrix(M1, M1, labels1 =paste(1:3), labels2 = paste(1:4), main = "Asymmetric", mainline = -1)
# Here is a more conservative style:
gt_bimatrix(matrix(c(1,0,0,0), 2, 2),
            labels1 = c("U","D"), labels2 = c("L","R"),
            pty = "m", matrixfill=NULL, nash = FALSE, arrow1= FALSE,
            asp = .45, tfont = "serif", tscale = .8)

macartan/hop documentation built on Jan. 4, 2022, 9:21 p.m.