49. Markov Perfect Equilibrium#

49.1. Overview#

This lecture describes the concept of Markov perfect equilibrium.

Markov perfect equilibrium is a key notion for analyzing economic problems involving dynamic strategic interaction, and a cornerstone of applied game theory.

In this lecture we teach Markov perfect equilibrium by example.

We will focus on settings with

  • two players

  • quadratic payoff functions

  • linear transition rules for the state

Other references include chapter 7 of [LS18].

using LinearAlgebra, Statistics, QuantEcon

49.2. Background#

Markov perfect equilibrium is a refinement of the concept of Nash equilibrium.

It is used to study settings where multiple decision makers interact non-cooperatively over time, each seeking to pursue its own objective.

The agents in the model face a common state vector, the time path of which is influenced by – and influences – their decisions.

In particular, the transition law for the state that confronts each agent is affected by decision rules of other agents.

Individual payoff maximization requires that each agent solve a dynamic programming problem that includes this transition law.

Markov perfect equilibrium prevails when no agent wishes to revise its policy, taking as given the policies of all other agents.

Well known examples include

  • Choice of price, output, location or capacity for firms in an industry (e.g., [EP95], [Rya12], [DS10]).

  • Rate of extraction from a shared natural resource, such as a fishery (e.g., [LM80], [VL11]).

Let’s examine a model of the first type.

49.2.1. Example: A duopoly model#

Two firms are the only producers of a good the demand for which is governed by a linear inverse demand function

(49.1)#p=a0a1(q1+q2)

Here p=pt is the price of the good, qi=qit is the output of firm i=1,2 at time t and a0>0,a1>0.

In (49.1) and what follows,

  • the time subscript is suppressed when possible to simplify notation

  • x^ denotes a next period value of variable x

Each firm recognizes that its output affects total output and therefore the market price.

The one-period payoff function of firm i is price times quantity minus adjustment costs:

(49.2)#πi=pqiγ(q^iqi)2,γ>0,

Substituting the inverse demand curve (49.1) into (49.2) lets us express the one-period payoff as

(49.3)#πi(qi,qi,q^i)=a0qia1qi2a1qiqiγ(q^iqi)2,

where qi denotes the output of the firm other than i.

The objective of the firm is to maximize t=0βtπit.

Firm i chooses a decision rule that sets next period quantity q^i as a function fi of the current state (qi,qi).

An essential aspect of a Markov perfect equilibrium is that each firm takes the decision rule of the other firm as known and given.

Given fi, the Bellman equation of firm i is

(49.4)#vi(qi,qi)=maxq^i{πi(qi,qi,q^i)+βvi(q^i,fi(qi,qi))}

Definition A Markov perfect equilibrium of the duopoly model is a pair of value functions (v1,v2) and a pair of policy functions (f1,f2) such that, for each i{1,2} and each possible state,

  • The value function vi satisfies the Bellman equation (49.4).

  • The maximizer on the right side of (49.4) is equal to fi(qi,qi).

The adjective “Markov” denotes that the equilibrium decision rules depend only on the current values of the state variables, not other parts of their histories.

“Perfect” means complete, in the sense that the equilibrium is constructed by backward induction and hence builds in optimizing behavior for each firm at all possible future states.

  • These include many states that will not be reached when we iterate forward on the pair of equilibrium strategies fi starting from a given initial state.

49.2.2. Computation#

One strategy for computing a Markov perfect equilibrium is iterating to convergence on pairs of Bellman equations and decision rules.

In particular, let vij,fij be the value function and policy function for firm i at the j-th iteration.

Imagine constructing the iterates

(49.5)#vij+1(qi,qi)=maxq^i{πi(qi,qi,q^i)+βvij(q^i,fi(qi,qi))}

These iterations can be challenging to implement computationally.

However, they simplify for the case in which the one-period payoff functions are quadratic and the transition laws are linear — which takes us to our next topic.

49.3. Linear Markov perfect equilibria#

As we saw in the duopoly example, the study of Markov perfect equilibria in games with two players leads us to an interrelated pair of Bellman equations.

In linear quadratic dynamic games, these “stacked Bellman equations” become “stacked Riccati equations” with a tractable mathematical structure.

We’ll lay out that structure in a general setup and then apply it to some simple problems.

49.3.1. Coupled linear regulator problems#

We consider a general linear quadratic regulator game with two players.

For convenience, we’ll start with a finite horizon formulation, where t0 is the initial date and t1 is the common terminal date.

Player i takes {uit} as given and minimizes

(49.6)#t=t0t11βtt0{xtRixt+uitQiuit+uitSiuit+2xtWiuit+2uitMiuit}

while the state evolves according to

(49.7)#xt+1=Axt+B1u1t+B2u2t

Here

  • xt is an n×1 state vector and uit is a ki×1 vector of controls for player i

  • Ri is n×n

  • Si is ki×ki

  • Qi is ki×ki

  • Wi is n×ki

  • Mi is ki×ki

  • A is n×n

  • Bi is n×ki

49.3.2. Computing Equilibrium#

We formulate a linear Markov perfect equilibrium as follows.

Player i employs linear decision rules uit=Fitxt, where Fit is a ki×n matrix.

A Markov perfect equilibrium is a pair of sequences {F1t,F2t} over t=t0,,t11 such that

  • {F1t} solves player 1’s problem, taking {F2t} as given, and

  • {F2t} solves player 2’s problem, taking {F1t} as given

If we take u2t=F2txt and substitute it into (49.6) and (49.7), then player 1’s problem becomes minimization of

(49.8)#t=t0t11βtt0{xtΠ1txt+u1tQ1u1t+2u1tΓ1txt}

subject to

(49.9)#xt+1=Λ1txt+B1u1t,

where

  • Λit:=ABiFit

  • Πit:=Ri+FitSiFit

  • Γit:=WiMiFit

This is an LQ dynamic programming problem that can be solved by working backwards.

The policy rule that solves this problem is

(49.10)#F1t=(Q1+βB1P1t+1B1)1(βB1P1t+1Λ1t+Γ1t)

where P1t solves the matrix Riccati difference equation

(49.11)#P1t=Π1t(βB1P1t+1Λ1t+Γ1t)(Q1+βB1P1t+1B1)1(βB1P1t+1Λ1t+Γ1t)+βΛ1tP1t+1Λ1t

Similarly, the policy that solves player 2’s problem is

(49.12)#F2t=(Q2+βB2P2t+1B2)1(βB2P2t+1Λ2t+Γ2t)

where P2t solves

(49.13)#P2t=Π2t(βB2P2t+1Λ2t+Γ2t)(Q2+βB2P2t+1B2)1(βB2P2t+1Λ2t+Γ2t)+βΛ2tP2t+1Λ2t

Here in all cases t=t0,,t11 and the terminal conditions are Pit1=0.

The solution procedure is to use equations (49.10), (49.11), (49.12), and (49.13), and “work backwards” from time t11.

Since we’re working backwards, P1t+1 and P2t+1 are taken as given at each stage.

Moreover, since

  • some terms on the right hand side of (49.10) contain F2t

  • some terms on the right hand side of (49.12) contain F1t

we need to solve these k1+k2 equations simultaneously.

49.3.2.1. Key insight#

A key insight is that equations (49.10) and (49.12) are linear in F1t and F2t.

After these equations have been solved, we can take Fit and solve for Pit in (49.11) and (49.13).

49.3.2.2. Infinite horizon#

We often want to compute the solutions of such games for infinite horizons, in the hope that the decision rules Fit settle down to be time invariant as t1+.

In practice, we usually fix t1 and compute the equilibrium of an infinite horizon game by driving t0.

This is the approach we adopt in the next section.

49.3.3. Implementation#

We use the function nnash from QuantEcon.jl that computes a Markov perfect equilibrium of the infinite horizon linear quadratic dynamic game in the manner described above.

49.4. Application#

Let’s use these procedures to treat some applications, starting with the duopoly model.

49.4.1. A duopoly model#

To map the duopoly model into coupled linear-quadratic dynamic programming problems, define the state and controls as

xt:=[1q1tq2t]anduit:=qi,t+1qit,i=1,2

If we write

xtRixt+uitQiuit

where Q1=Q2=γ,

R1:=[0a020a02a1a120a120]andR2:=[00a0200a12a02a12a1]

then we recover the one-period payoffs in expression (49.3).

The law of motion for the state xt is xt+1=Axt+B1u1t+B2u2t where

A:=[100010001],B1:=[010],B2:=[001]

The optimal decision rule of firm i will take the form uit=Fixt, inducing the following closed loop system for the evolution of x in the Markov perfect equilibrium:

(49.14)#xt+1=(AB1F1B1F2)xt

49.4.2. Parameters and Solution#

Consider the previously presented duopoly model with parameter values of:

  • a0=10

  • a1=2

  • β=0.96

  • γ=12

From these we compute the infinite horizon MPE using the following code

using QuantEcon, LinearAlgebra

# parameters
a0 = 10.0
a1 = 2.0
beta = 0.96
gamma = 12.0

# in LQ form
A = I + zeros(3, 3)
B1 = [0.0, 1.0, 0.0]
B2 = [0.0, 0.0, 1.0]

R1 = [0.0 -a0/2.0 0.0;
      -a0/2.0 a1 a1/2.0;
      0.0 a1/2.0 0.0]

R2 = [0.0 0.0 -a0/2.0;
      0.0 0.0 a1/2.0;
      -a0/2.0 a1/2.0 a1]

Q1 = Q2 = gamma
S1 = S2 = W1 = W2 = M1 = M2 = 0.0

# solve using QE's nnash function
F1, F2, P1, P2 = nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2,
                       beta = beta)

# display policies
println("Computed policies for firm 1 and firm 2:")
println("F1 = $F1")
println("F2 = $F2")
Computed policies for firm 1 and firm 2:
F1 = [-0.6684661455442794 0.295124817744414 0.0758466630580742]
F2 = [-0.6684661455442794 0.07584666305807419 0.295124817744414]

Running the code produces the following output.

One way to see that Fi is indeed optimal for firm i taking F2 as given is to use QuantEcon.jl’s LQ type.

In particular, let’s take F2 as computed above, plug it into (49.8) and (49.9) to get firm 1’s problem and solve it using LQ.

We hope that the resulting policy will agree with F1 as computed above

Lambda1 = A - (B2 * F2)
lq1 = QuantEcon.LQ(Q1, R1, Lambda1, B1, bet = beta)
P1_ih, F1_ih, d = stationary_values(lq1)
F1_ih
1×3 Matrix{Float64}:
 -0.668466  0.295125  0.0758467

This is close enough for rock and roll, as they say in the trade.

Indeed, isapprox agrees with our assessment

isapprox(F1, F1_ih, atol = 1e-7)
true

49.4.3. Dynamics#

Let’s now investigate the dynamics of price and output in this simple duopoly model under the MPE policies.

Given our optimal policies F1 and F2, the state evolves according to (49.14).

The following program

  • imports F1 and F2 from the previous program along with all parameters

  • computes the evolution of xt using (49.14)

  • extracts and plots industry output qt=q1t+q2t and price pt=a0a1qt

using LaTeXStrings, Plots

AF = A - B1 * F1 - B2 * F2
n = 20
x = zeros(3, n)
x[:, 1] = [1 1 1]
for t in 1:(n - 1)
    x[:, t + 1] = AF * x[:, t]
end
q1 = x[2, :]
q2 = x[3, :]
q = q1 + q2         # total output, MPE
p = a0 .- a1 * q     # price, MPE

plt = plot(q, color = :blue, lw = 2, alpha = 0.75, label = "total output")
plot!(plt, p, color = :green, lw = 2, alpha = 0.75, label = "price")
plot!(plt, title = "Output and prices, duopoly MPE")

Note that the initial condition has been set to q10=q20=1.0.

To gain some perspective we can compare this to what happens in the monopoly case.

The first panel in the next figure compares output of the monopolist and industry output under the MPE, as a function of time.

The second panel shows analogous curves for price

../_images/mpe_vs_monopolist.png

Here parameters are the same as above for both the MPE and monopoly solutions.

The monopolist initial condition is q0=2.0 to mimic the industry initial condition q10=q20=1.0 in the MPE case.

As expected, output is higher and prices are lower under duopoly than monopoly.

49.5. Exercises#

49.5.1. Exercise 1#

Replicate the pair of figures showing the comparison of output and prices for the monopolist and duopoly under MPE.

Parameters are as in duopoly_mpe.jl and you can use that code to compute MPE policies under duopoly.

The optimal policy in the monopolist case can be computed using QuantEcon.jl’s LQ type.

49.5.2. Exercise 2#

In this exercise we consider a slightly more sophisticated duopoly problem.

It takes the form of infinite horizon linear quadratic game proposed by Judd [Jud90].

Two firms set prices and quantities of two goods interrelated through their demand curves.

Relevant variables are defined as follows:

  • Iit = inventories of firm i at beginning of t

  • qit = production of firm i during period t

  • pit = price charged by firm i during period t

  • Sit = sales made by firm i during period t

  • Eit = costs of production of firm i during period t

  • Cit = costs of carrying inventories for firm i during t

The firms’ cost functions are

  • Cit=ci1+ci2Iit+0.5ci3Iit2

  • Eit=ei1+ei2qit+0.5ei3qit2 where eij,cij are positive scalars

Inventories obey the laws of motion

Ii,t+1=(1δ)Iit+qitSit

Demand is governed by the linear schedule

St=Dpit+b

where

  • St=[S1tS2t]

  • D is a 2×2 negative definite matrix and

  • b is a vector of constants

Firm i maximizes the undiscounted sum

limT 1T t=0T (pitSitEitCit)

We can convert this to a linear quadratic problem by taking

uit=[pitqit]andxt=[I1tI2t1]

Decision rules for price and quantity take the form uit=Fixt.

The Markov perfect equilibrium of Judd’s model can be computed by filling in the matrices appropriately.

The exercise is to calculate these matrices and compute the following figures.

The first figure shows the dynamics of inventories for each firm when the parameters are

delta = 0.02
D = [-1 0.5;
     0.5 -1]
b = [25, 25]
c1 = c2 = [1, -2, 1]
e1 = e2 = [10, 10, 3]
3-element Vector{Int64}:
 10
 10
  3
../_images/judd_fig2.png

Inventories trend to a common steady state.

If we increase the depreciation rate to δ=0.05, then we expect steady state inventories to fall.

This is indeed the case, as the next figure shows

../_images/judd_fig1.png

49.6. Solutions#

49.6.1. Exercise 1#

First let’s compute the duopoly MPE under the stated parameters

# parameters
a0 = 10.0
a1 = 2.0
beta = 0.96
gamma = 12.0

# in LQ form
A = I + zeros(3, 3)
B1 = [0.0, 1.0, 0.0]
B2 = [0.0, 0.0, 1.0]

R1 = [0.0 -a0/2.0 0.0;
      -a0/2.0 a1 a1/2.0;
      0.0 a1/2.0 0.0]

R2 = [0.0 0.0 -a0/2.0;
      0.0 0.0 a1/2.0;
      -a0/2.0 a1/2.0 a1]

Q1 = Q2 = gamma
S1 = S2 = W1 = W2 = M1 = M2 = 0.0

# solve using QE's nnash function
F1, F2, P1, P2 = nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2,
                       beta = beta)
([-0.6684661455442794 0.295124817744414 0.0758466630580742], [-0.6684661455442794 0.07584666305807419 0.295124817744414], [-100.74013291681777 -13.28370101134053 2.4358738882344184; -13.283701011340526 5.441368457863285 1.9305445296892971; 2.4358738882344166 1.9305445296892967 -0.18944247543524878], [-100.74013291681776 2.4358738882344175 -13.283701011340527; 2.4358738882344166 -0.18944247543524873 1.9305445296892967; -13.283701011340526 1.9305445296892971 5.441368457863285])

Now we evaluate the time path of industry output and prices given initial condition q10=q20=1

AF = A - B1 * F1 - B2 * F2
n = 20
x = zeros(3, n)
x[:, 1] = [1  1  1]
for t in 1:(n-1)
    x[:, t+1] = AF * x[:, t]
end
q1 = x[2, :]
q2 = x[3, :]
q = q1 + q2       # Total output, MPE
p = a0 .- a1 * q   # Price, MPE
Hide code cell output
20-element Vector{Float64}:
 6.0
 4.810021341032835
 4.061490827306079
 3.590643786682385
 3.2944675699503305
 3.108164282917846
 2.990974202154173
 2.917258299186763
 2.8708888939018653
 2.8417212155594376
 2.8233739140432714
 2.811832938139286
 2.8045733351563076
 2.8000068378419645
 2.7971343807984024
 2.795327523397832
 2.7941909585627513
 2.793476026867568
 2.7930263144420184
 2.7927434325009113

Next let’s have a look at the monopoly solution.

For the state and control we take

xt=qtq¯andut=qt+1qt

To convert to an LQ problem we set

R=a1andQ=γ

in the payoff function xtRxt+utQut and

A=B=1

in the law of motion xt+1=Axt+But.

We solve for the optimal policy ut=Fxt and track the resulting dynamics of {qt}, starting at q0=2.0.

R = a1
Q = gamma
A = B = 1
lq_alt = QuantEcon.LQ(Q, R, A, B, bet=beta)
P, F, d = stationary_values(lq_alt)
 = a0 / (2.0 * a1)
qm = zeros(n)
qm[1] = 2
x0 = qm[1]-
x = x0
for i in 2:n
    x = A * x - B * F[1] * x
    qm[i] = float(x) + 
end
pm = a0 .- a1 * qm
Hide code cell output
20-element Vector{Float64}:
 6.0
 5.6828385746634025
 5.466268519048347
 5.318386130957389
 5.217406331855539
 5.148453429767034
 5.1013697283860155
 5.069219160845123
 5.04726551313088
 5.032274715617025
 5.022038420809596
 5.015048683853457
 5.010275821833055
 5.007016727533978
 5.004791292228103
 5.003271679155834
 5.002234028731525
 5.0015254809947916
 5.00104165726816
 5.000711283764278

Let’s have a look at the different time paths

plt_q = plot(qm, color = :blue, lw = 2, alpha = 0.75,
             label = "monopolist output")
plot!(plt_q, q, color = :green, lw = 2, alpha = 0.75,
      label = "MPE total output")
plot!(plt_q, xlabel = "time", ylabel = "output", ylim = (2, 4),
      legend = :topright)

plt_p = plot(pm, color = :blue, lw = 2, alpha = 0.75,
             label = "monopolist price")
plot!(plt_p, p, color = :green, lw = 2, alpha = 0.75, label = "MPE price")
plot!(plt_p, xlabel = "time", ylabel = "price", legend = :topright)

plot(plt_q, plt_p, layout = (2, 1), size = (700, 600))

49.6.2. Exercise 2#

We treat the case δ=0.02

delta = 0.02
D = [-1 0.5;
     0.5 -1]
b = [25, 25]
c1 = c2 = [1, -2, 1]
e1 = e2 = [10, 10, 3]
delta_1 = 1 - delta
0.98

Recalling that the control and state are

uit=[pitqit]andxt=[I1tI2t1]

we set up the matrices as follows:

# create matrices needed to compute the Nash feedback equilibrium
A = [delta_1 0 -delta_1*b[1];
     0 delta_1 -delta_1*b[2];
     0 0 1]

B1 = delta_1 * [1 -D[1, 1];
                0 -D[2, 1];
                0 0]
B2 = delta_1 * [0 -D[1, 2];
                1 -D[2, 2];
                0 0]

R1 = -[0.5*c1[3] 0 0.5*c1[2];
       0 0 0;
       0.5*c1[2] 0 c1[1]]

R2 = -[0 0 0;
       0 0.5*c2[3] 0.5*c2[2];
       0 0.5*c2[2] c2[1]]

Q1 = [-0.5*e1[3] 0;
      0 D[1, 1]]
Q2 = [-0.5*e2[3] 0;
      0 D[2, 2]]

S1 = zeros(2, 2)
S2 = copy(S1)

W1 = [0.0 0.0;
      0.0 0.0;
      -0.5*e1[2] b[1]/2.0]
W2 = [0.0 0.0;
      0.0 0.0;
      -0.5*e2[2] b[2]/2.0]

M1 = [0.0 0.0;
      0.0 D[1, 2]/2.0]
M2 = copy(M1)
2×2 Matrix{Float64}:
 0.0  0.0
 0.0  0.25

We can now compute the equilibrium using qe.nnash

F1, F2, P1, P2 = nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2)

println("\nFirm 1's feedback rule:\n")
println(F1)

println("\nFirm 2's feedback rule:\n")
println(F2)
Firm 1's feedback rule:
[0.24366658220856494 0.027236062661951197 -6.8278829260303215; 0.3923707338756387 0.13969645088599783 -37.734107288592014]

Firm 2's feedback rule:

[0.027236062661951214 0.243666582208565 -6.82788292603033; 0.13969645088599786 0.39237073387563864 -37.73410728859202]

Now let’s look at the dynamics of inventories, and reproduce the graph corresponding to δ=0.02

AF = A - B1 * F1 - B2 * F2
n = 25
x = zeros(3, n)
x[:, 1] = [2 0 1]
for t in 1:(n - 1)
    x[:, t + 1] = AF * x[:, t]
end
I1 = x[1, :]
I2 = x[2, :]

plot(I1, color = :blue, lw = 2, alpha = 0.75, label = "inventories, firm 1")
plot!(I2, color = :green, lw = 2, alpha = 0.75, label = "inventories, firm 2")
plot!(title = L"\delta = 0.02")