Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Nash equilibria of a two-player game with two strategies each

e(u_11, u_12, u_21, u_22, v_11, v_12, v_21, v_22) = (NE_11, NE_12, NE_21, NE_22, p_star, q_star)

Maps the payoffs of two players, each with two pure strategies, over the four strategy pairs to the game's Nash equilibria, the pairs in which each player's strategy is a best reply to the other's, u_i(s_i*, s_-i*) >= u_i(s_i, s_-i*) for every strategy s_i of every player i, as in the article's display. The general condition over any finite strategy sets has no calculator form. For a 2 x 2 game HE-FM-NASH-001 tests each of the four cells as a pure-strategy equilibrium and classifies it as strict or weak, HE-FM-NASH-002 gives the mixed equilibrium in which each player randomises so as to leave the other indifferent, and HE-CF-NASH-001 lists every equilibrium of a game without payoff ties and values the outcome of mixed play. Each player's expected payoff at the mixed equilibrium and the expected value of an outcome measure such as total surplus are probability-weighted sums, the form of HE-FM-CHN-001, and the probability of each cell under independent mixing is the product of HE-FM-CHN-002, so neither is restated. Dominance between interventions in cost-effectiveness analysis (HE-FM-DOM-001) compares the incremental cost and effect of options for one decision maker and is a different test. The Nash bargaining solution (HE-FN-BARG-001, with the negotiated price of HE-FM-BARG-001) divides a surplus between parties who can make a binding agreement, Rubinstein's first proposer's share (HE-FM-BARG-003) comes from the perfect equilibrium of a sequential alternating-offers game, and the voluntary vaccination coverage of HE-FM-VEXT-003 is the equilibrium of a population game solved through an infection risk; all are separate records. Notation follows the Nash Equilibrium article, with u_jk and v_jk for the row and column players' payoffs when the row player chooses its strategy j and the column player its strategy k.

  • Pure-strategy best-reply check of each cell of a 2 x 2 game with strict and weak equilibria

    NE_11 = (u_11 >= u_21) and (v_11 >= v_12); NE_12 = (u_12 >= u_22) and (v_12 >= v_11); NE_21 = (u_21 >= u_11) and (v_21 >= v_22); NE_22 = (u_22 >= u_12) and (v_22 >= v_21); S_11 = (u_11 > u_21) and (v_11 > v_12); S_12 = (u_12 > u_22) and (v_12 > v_11); S_21 = (u_21 > u_11) and (v_21 > v_22); S_22 = (u_22 > u_12) and (v_22 > v_21)

    Tests each of the four strategy pairs of a two-player game in which each player has two strategies. A cell is a pure-strategy Nash equilibrium when the row player's payoff in it is at least its payoff from switching rows against the same column, and the column player's payoff in it is at least its payoff from switching columns against the same row, which is Definition 5.1 of Tadelis applied cell by cell as in his section 5.1.1. The cell is a strict equilibrium when both comparisons hold with a strict inequality, Definition 7 of Slantchev, and a cell that passes the weak test but fails the strict one is a weak equilibrium, because some player has an alternative that does exactly as well. Each output is 1 for a pass and 0 for a fail. A game in which no cell passes, such as matching pennies, still has an equilibrium in mixed strategies (HE-FM-NASH-002).

  • Mixed-strategy equilibrium probabilities of a 2 x 2 game from the indifference conditions

    a_1 = u_11 - u_21; a_2 = u_22 - u_12; q_star = a_2 / (a_1 + a_2); b_1 = v_11 - v_12; b_2 = v_22 - v_21; p_star = b_2 / (b_1 + b_2); interior = (q_star > 0) and (q_star < 1) and (p_star > 0) and (p_star < 1)

    In a mixed equilibrium of a game in which each player has two strategies, each player randomises over both, which it is willing to do only if both give it the same expected payoff, so each player's mixing probability is set by the other player's payoffs. Equating the row player's expected payoffs from its two strategies, q u_11 + (1 minus q) u_12 = q u_21 + (1 minus q) u_22, gives the probability q_star that the column player chooses its first strategy, and the column player's indifference gives the probability p_star that the row player chooses its first strategy. Slantchev states this condition for 2 x 2 games and solves it for the equilibrium probabilities; the closed forms are that equation solved (derived). The pair is a mixed equilibrium when both values are above 0 and below 1, which is what Proposition 1 of Slantchev requires when each player mixes over two strategies (derived); when q_star is not, the row player has a strictly dominant strategy (derived, for games without the ties of HE-AS-NASH-005), and likewise p_star for the column player. The algebra is that of the decision curve threshold HE-FM-DCA-004, p_t = L / (G + L), and of the blend weight in HE-FM-EXD-002, with a_1 and a_2 in place of G and L, but HE-VR-DCA-013 to HE-VR-DCA-015 define p_t as a patient's risk and G and L as a patient's benefit and harm, while here the probability is the other player's equilibrium choice, set by the payoffs of the player it leaves indifferent and an equilibrium only as a pair with p_star. When a_1 and a_2 are both negative, as in the angioplasty game, listing the row player's strategies in the other order makes both positive and leaves q_star unchanged (derived). Each player's expected payoff at the equilibrium is HE-FM-CHN-001 applied to its payoffs against the other's mix.