gt_tree: Game Tree

Description Usage Arguments Details Examples

View source: R/gt_tree.R

Description

Thus function is in development. It draws game trees and identifies subgame perfect equilibria when this is unique Backwards induction is implemented under the assumption that utilities are "generic" and so a unique solution exits.

Usage

1
2
3
4
5
6
7
8
gt_tree(H, U, P, player.names = c(1:ncol(U)), playercol = "black",
  title = "", titlecol = "black", textsize = 1.5, titlesize = textsize,
  utextsize = textsize, btextsize = textsize, solution = TRUE,
  force_solution = FALSE, mark.branches = ((ncol(H) - 1):1),
  offset = 0.18, thickline = 3, print.utilities = rep(TRUE, ncol(U)),
  uspacing = 0.5, slopetext = TRUE, actioncol = "blue",
  branchcol = "black", solutioncol = "black", sadj = ncol(H)/(nrow(H) +
  1), uss = TRUE, angled = FALSE, warnings = TRUE)

Arguments

player.names,

a matrix of player labels in the order specified in U

textsize

Text size

utextsize

is textsize for utilities

solution

FALSE to turn off computation of SPNE

force_solution

TRUE to force a solution for a non-generic game

offset

Used to adjust text offsetting

sadj

does a fix on the text slope

uss

indicates to write utilities in form u_name; otherwise just name

warnings

print warnings

H:

A matrix of histories with one row per terminal node, and one column per time period, entries are node labels. First column is normally all 0s for the origin; if first column has variation an origin is added to the hostory.

U:

A matrix of utilities with one row per terminal node, and one column per player

P:

A matrix of players identifiers (numbered according to columns in U), row per terminal node, and one column per time period (less one)

thickness

of line for SPNE

Details

In this version the graphing is not good when there are multiple solutions or indifference at given nodes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# A chicken game:
  H <- matrix(c("C", "C", "D", "D", "C", "D",  "C", "D"),4)
  U <- matrix(c(1,0,2,-1,1,2, 0, -1), 4)
  P <- matrix(c(rep(1,4), rep(2,4)),4)
  gt_tree(H,U,P, title = "Sequential Chicken")
# A game in which options depend on past history.
  H <- matrix(c("Take hostages", "Take hostages", "             Don't take hostages", "Pay Ransom", "Don't pay", ""),3)
  U <- matrix(c(1,-1,0,-1,-2,0), 3)
  P <-  matrix(c(rep(1,3), c(2,2,1)),3)
  gt_tree(H,U,P,solution=FALSE, player.names=c("Militants", "Gov"))
Same game with a solution, though note the phantom highlighting in this example.
  gt_tree(H,U,P,solution=TRUE, player.names=c("Militants", "Gov"))

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