gt_brgraph: Plot best reactions for two person normal form games

Description Usage Arguments Examples

View source: R/gt_brgraph.R

Description

This function plots best reactions. Intersections are Nash equilibria. Thanks to Neelan Sircar for developing much of this code. To show utilities for players use util = TRUE. To show best response functions use BR = TRUE. Both can be done also with output either aligned horizontally or vertically, using vert.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
gt_brgraph(X, Y = t(X), players = c("Row", "Col"), PR = players[1],
  P1 = PR, PC = players[2], P2 = PC, labelsR = c("C", "D"),
  labels1 = labelsR, labelsC = labels1, labels2 = labelsC, legBR = TRUE,
  legr = TRUE, legc = TRUE, leglocBR = c(0.8, 0.2), legxyr = c(c(0.8, 3
  * (min(C) + max(C))/4)), legxyc = c(c(0.8, (min(C) + max(C))/4)),
  ulegend = TRUE, BR = TRUE, br = BR, draw1 = TRUE, draw2 = TRUE,
  vert = TRUE, util = FALSE, overrow = TRUE, Rloc = NULL, Cloc = NULL,
  ur = TRUE, u1 = ur, uc = TRUE, u2 = uc, cthighlight = FALSE,
  rthighlight = FALSE, cbhighlight = FALSE, rbhighlight = FALSE,
  colr = "red", colc = gray(0.4), col1 = colr, col2 = colc,
  mmcol_r = "pink", mmcol_c = grey(0.8), mmcol_1 = mmcol_r,
  mmcol_2 = mmcol_c, xlabu = paste("Probability on", labelsR[1], "for", PR),
  ylabu = NULL, legtextr = c(paste(PR, "'s utility | ", PC, " plays ",
  labelsC[1], ")", sep = ""), paste(PR, "'s utility | ", PC, " plays ",
  labelsC[2], ")", sep = "")), legtextc = c(paste(PC, "'s utility | ", PC,
  " plays ", labelsC[1], ")", sep = ""), paste(PC, "'s utility | ", PC,
  " plays ", labelsC[2], ")", sep = "")), mainbr = "", mainu = "",
  hl_lwd = 8, lwd = 2)

Arguments

PR

Name of row player

P1

alternative argument for Row Name

PC

Name of column player

P2

alternative argument for Col Name

overrow

Switch to have utilty plots plotted over row player (player 1)

R

Row payoffs

C

Column payoffs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
C <- matrix(c(1,0,0,1),2,2)
R <- matrix(c(1,0,0,1),2,2)
gt_brgraph(R, C, PR="Country R", PC="Country C", leglocBR=c(.8,.2))
# A chicken game:

gt_brgraph(Chicken, BR = FALSE, util = TRUE,
  cthighlight = TRUE, rthighlight = TRUE,
  labelsC = c("Jill A", "Jill B"),
  labelsC = c("Jack A", "Jack B"),
  ur = TRUE,
  PC = "Jill", PR = "Jack")

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