| solve_nfg | R Documentation | 
solve_nfg() finds Nash equilibria of a normal-form game.
solve_nfg(
  game,
  mixed = FALSE,
  show_table = TRUE,
  mark_br = TRUE,
  cons1 = NULL,
  cons2 = NULL,
  cons_common = NULL,
  precision = 1,
  plot = TRUE,
  mark_NE = FALSE,
  quietly = FALSE,
  color_palette = "Set1"
)
game | 
 A "normal_form" class object created by   | 
mixed | 
 A logical value. If   | 
show_table | 
 A logical value. If   | 
mark_br | 
 A logical value. If   | 
cons1 | 
 A named list of parameters contained in
  | 
cons2 | 
 A named list of parameters contained in
  | 
cons_common | 
 A named list of parameters contained in
  | 
precision | 
 A natural number specifying the precision of numerical approximation. The value n approximately means that the approximation is correct up to the Nth decimal place. The default value is 1.  | 
plot | 
 A logical value to determine whether the figure of the best
response correspondences will be displayed. Default is   | 
mark_NE | 
 A logical value to control if the NE (if any) will be marked
in the best response plot, which will be displayed (only displayed when
  | 
quietly | 
 A logical value that determines whether the equilibrium will
be kept in the returned list without being printed on screen. Default is
  | 
color_palette | 
 A color palette to be used. Default is   | 
This function finds Nash equilibria of a normal-form game by
solve_nfg_matrix, solve_nfg_char, or
solve_nfg_fcn depending on type of a "normal_form"
object defined by normal_form.
A list containing Nash equilibria (if any), the payoff matrix of the game (if available), and the plot of best response correspondence (if available).
Yoshio Kamijo and Yuki Yanai yanai.yuki@kochi-tech.ac.jp
game1 <- normal_form(
  s1 = c("T", "B"),
  s2 = c("L", "R"),
  payoffs1 = c(4, 2, 3, 1),
  payoffs2 = c(4, 3, 2, 1))
s1 <- solve_nfg(game1, show_table = FALSE)
game2 <- normal_form(
  payoffs1 = "-x1^2 + (28 - x2) * x1",
  payoffs2 = "-x2^2 + (28 - x1) * x2",
  par1_lim = c(0, 30),
  par2_lim = c(0, 30),
  pars = c("x1", "x2"))
s2 <- solve_nfg(game2)
fx <- function(x, y) -x^2 + (28 - y) * x
fy <- function(x, y) -y^2 + (28 - x) * y
game3 <- normal_form(
    payoffs1 = fx,
    payoffs2 = fy,
    pars = c("x", "y"),
    par1_lim = c(0, 40),
    par2_lim = c(0, 40))
s3 <- solve_nfg(game3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.