Skip to content

Commit 3308733

Browse files
Tom's first edits of dyn_stack.md on April 6
1 parent 253d990 commit 3308733

File tree

1 file changed

+62
-29
lines changed

1 file changed

+62
-29
lines changed

lectures/dyn_stack.md

Lines changed: 62 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,13 @@ The max-min problem associated with firm 2's Lagrangian
311311
component of firm $2$'s payoff function depends on the entire
312312
future of its choices of $\{q_{2t+j}\}_{j=0}^\infty$.
313313

314-
This renders a direct attack on the problem cumbersome.
314+
This renders a direct attack on the problem in the space of sequences cumbersome.
315315

316-
Therefore, below we will formulate the Stackelberg leader's problem
316+
Therefore, below we will formulate the Stackelberg leader's problem
317317
recursively.
318318

319-
We'll put our little duopoly model into a broader class of models with
320-
the same structure.
319+
We'll proceed by putting our duopoly model into a broader class of models with
320+
the same general structure.
321321

322322
## Stackelberg Problem
323323

@@ -440,14 +440,14 @@ $$
440440
\Omega(y_0) = \left\{ (\vec y_1, \vec u_0) : y_{t+1} = A y_t + B u_t, \forall t \geq 0 \right\}
441441
$$
442442

443-
Please remember that the follower's Euler equation is embedded in the
443+
Please remember that the follower's system of Euler equations is embedded in the
444444
system of dynamic equations $y_{t+1} = A y_t + B u_t$.
445445

446-
Note that in the definition of $\Omega(y_0)$, $y_0$
447-
is taken as given.
446+
Note that the definition of $\Omega(y_0)$ treats $y_0$
447+
as given.
448448

449449
Although it is taken as given in $\Omega(y_0)$,
450-
eventually, the $x_0$ component of $y_0$ will be chosen by the
450+
eventually, the $x_0$ component of $y_0$ is to be chosen by the
451451
Stackelberg leader.
452452

453453
### Two Subproblems
@@ -490,8 +490,7 @@ given.
490490
Subproblem 2 optimizes over $x_0$.
491491

492492
The value function $w(z_0)$ tells the value of the Stackelberg plan
493-
as a function of the vector of natural state variables at time $0$,
494-
$z_0$.
493+
as a function of the vector of natural state variables $z_0$ at time $0$.
495494

496495
## Two Bellman Equations
497496

@@ -554,20 +553,50 @@ which implies that
554553

555554
$$
556555
x_0 = - P_{22}^{-1} P_{21} z_0
557-
$$
556+
$$ (eq:subprob2x0)
558557
559-
## Stackelberg Plan
558+
## Stackelberg Plan for Duopoly
560559
561560
Now let's map our duopoly model into the above setup.
562561
563-
We will formulate a state space system
562+
We formulate a state vector
564563
565564
$$
566565
y_t = \begin{bmatrix} z_t \cr x_t \end{bmatrix}
567566
$$
568567
569-
where in this instance $x_t = v_{1t}$, the time $t$ decision
570-
of the follower firm 1.
568+
where for our duopoly model
569+
570+
$$
571+
z_t = \begin{bmatrix} 1 \cr q_{2t} \cr q_{1t} \end{bmatrix} , \quad x_t = v_{1t},
572+
$$
573+
574+
575+
where $x_t = v_{1t}$ is the time $t$ decision
576+
of the follower firm 1, $u_t$ is the time $t$ decision of the leader firm 2 and
577+
578+
$$
579+
v_{1t} = q_{1t+1} - q_{1t}, \quad u_t = q_{2t+1} - q_{2t} .
580+
$$
581+
582+
For our duopoly model, initial conditions for the natural state variables in $z_t$ are
583+
584+
$$
585+
z_0 = \begin{bmatrix} 1 \cr q_{20} \cr q_{10} \end{bmatrix}
586+
$$
587+
588+
while $x_0 = v_{10} = q_{11} - q_{10}$ is a choice variable for the Stackelberg leader firm 2, one that will ultimately be chosen according an optimal rule prescribed by {eq}`eq:subprob2x0`
589+
for subproblem 2 above.
590+
591+
That the Stackelberg leader firm 2 chooses $x_0 = v_{10}$ is subtle.
592+
593+
Of course, $x_0 = v_{10}$ emerges from the feedback-feedforward solution {eq}`sstack3` of firm 1's system of Euler equations, so that it is actually
594+
firm 1 that sets $x_0$.
595+
596+
But firm 2 manipulates firm 1's choice through firm 2's choice of the sequence $\vec q_{2,1} = \{q_{2t+1}\}_{t=0}^\infty$.
597+
598+
599+
571600
572601
### Calculations to Prepare Duopoly Model
573602
@@ -903,19 +932,21 @@ $\vec q_2$.
903932
### Time Consistency of Follower's Plan
904933
905934
The follower can solve its problem using dynamic programming because its
906-
problem is recursive in **natural state variables**,
935+
problem is recursive in what for it are the **natural state variables**,
907936
namely
908937
909938
$$
910-
\begin{bmatrix} 1 \cr q_{2t} \cr \tilde q_{10} \cr \tilde x_0 \end{bmatrix}
939+
\begin{bmatrix} 1 \cr q_{2t} \cr \tilde q_{1t} \cr \tilde x_t \end{bmatrix}
911940
$$
912941
913942
It follows that the follower's plan is time consistent.
914943
915944
## Computing Stackelberg Plan
916945
917946
Here is our code to compute a Stackelberg plan via the linear-quadratic
918-
dynamic program describe above
947+
dynamic program describe above.
948+
949+
Let's use it to compute the Stackelberg plan.
919950
920951
```{code-cell} python3
921952
# Parameters
@@ -982,13 +1013,15 @@ for t in range(n):
9821013
π_leader[t] = -(yt[:, t].T @ π_matrix @ yt[:, t])
9831014
9841015
# Display policies
985-
print("Computed policy for Stackelberg leader\n")
1016+
print("Computed policy for Continuation Stackelberg leader\n")
9861017
print(f"F = {F}")
9871018
```
9881019
9891020
## Time Series for Price and Quantities
9901021
991-
The following code plots the price and quantities produced by the Stackelberg leader and follower.
1022+
Now let's use the code to compute and display outcomes as a Stackelberg plan unfolds.
1023+
1024+
The following code plots quantities chosen by the Stackelberg leader and follower, together with the equilibrium output price.
9921025
9931026
```{code-cell} python3
9941027
q_leader = yt[1, :-1]
@@ -1008,7 +1041,7 @@ plt.show()
10081041
10091042
### Value of Stackelberg Leader
10101043
1011-
We'll compute the present value earned by the Stackelberg leader.
1044+
We'll compute the value $w(x_0)$ attained by the Stackelberg leader, where $x_0$ is given by the maximizer {eq}`eq:subprob2x0` of subproblem 2.
10121045
10131046
We'll compute it two ways and get the same answer.
10141047
@@ -1042,10 +1075,10 @@ v_expanded = -((y0.T @ R @ y0 + ut[:, 0].T @ Q @ ut[:, 0] +
10421075
10431076
In the code below we compare two values
10441077
1045-
- the continuation value $- y_t P y_t$ earned by a continuation
1046-
Stackelberg leader who inherits state $y_t$ at $t$
1047-
- the value of a **reborn Stackelberg leader** who inherits state
1048-
$z_t$ at $t$ and is free to set $x_t = - P_{22}^{-1} P_{21}$
1078+
- the continuation value $v(y_t) = - y_t' P y_t$ earned by a **continuation
1079+
Stackelberg leader** who inherits state $y_t$ at $t$
1080+
- the value $w(\hat x_t)$ of a **reborn Stackelberg leader** who, at date $t$ along the Stackelberg plan, inherits state
1081+
$z_t$ at $t$ but who discards $x_t$ from the time $t$ continuation of the original Stackelberg plan and **resets** it to $ \hat x_t = - P_{22}^{-1} P_{21} z_t$
10491082
10501083
The difference between these two values is a tell-tale sign of the time
10511084
inconsistency of the Stackelberg plan
@@ -1069,17 +1102,17 @@ fig, axes = plt.subplots(3, 1, figsize=(10, 7))
10691102
axes[0].plot(range(n+1), (- F @ yt).flatten(), 'bo',
10701103
label='Stackelberg leader', ms=2)
10711104
axes[0].plot(range(n+1), (- F @ yt_reset).flatten(), 'ro',
1072-
label='continuation leader at t', ms=2)
1073-
axes[0].set(title=r'Leader control variable $u_{t}$', xlabel='t')
1105+
label='reborn at t Stackelberg leader', ms=2)
1106+
axes[0].set(title=r' $u_{t} = q_{2t+1} - q_t$', xlabel='t')
10741107
axes[0].legend()
10751108
10761109
axes[1].plot(range(n+1), yt[3, :], 'bo', ms=2)
10771110
axes[1].plot(range(n+1), yt_reset[3, :], 'ro', ms=2)
1078-
axes[1].set(title=r'Follower control variable $x_{t}$', xlabel='t')
1111+
axes[1].set(title=r' $x_{t} = q_{1t+1} - q_{1t}$', xlabel='t')
10791112
10801113
axes[2].plot(range(n), vt_leader, 'bo', ms=2)
10811114
axes[2].plot(range(n), vt_reset_leader, 'ro', ms=2)
1082-
axes[2].set(title=r'Leader value $v(y_{t})$', xlabel='t')
1115+
axes[2].set(title=r'$v(y_{t})$ and $w(\hat x_t)$', xlabel='t')
10831116
10841117
plt.tight_layout()
10851118
plt.show()

0 commit comments

Comments
 (0)