2023-02-12

実行しつつコードを表示

g1 <- normal_form(
  players = c("player 1", "player 2"), 
  s1 = c("C", "D"), 
  s2 = c("C", "D"),   
  payoffs1 = c(4, 5, 1, 2),
  payoffs2 = c(4, 1, 5, 2),
)

sol_g1 <- solve_nfg(g1, 
                    mark_br = FALSE, 
                    mixed = TRUE, 
                    show_table = FALSE)

利得表を表示

sol_g1$table
player 2
strategy C D
player 1 C 4, 4 1, 5
D 5, 1 2, 2

最適反応を表示

sol_g1$br_plot

支配関係を表示

コードは表示しない

## $dominated
## $dominated$`player 1`
## [1] "C"
## 
## $dominated$`player 2`
## [1] "C"
## 
## 
## $w_dominated
## $w_dominated$`player 1`
## [1] "C"
## 
## $w_dominated$`player 2`
## [1] "C"

展開形ゲーム

g2 <- seq_form(
  players = c("P1", "P2"), 
  s1 = c("C", "D"), 
  s2 = c("C", "D"),   
  payoffs1 = c(4, 5, 1, 2),
  payoffs2 = c(4, 1, 5, 2),
)

ゲームの木

g3 <- seq_extensive(g2)

向きを変える

g3 <- seq_extensive(g2, direction = "right")

向きを変える

g3 <- seq_extensive(g2, direction = "up")

向きを変える

g3 <- seq_extensive(g2, direction = "vertical")