Skip to content

Commit f4ecd4b

Browse files
committed
update lecture
1 parent 60235eb commit f4ecd4b

File tree

1 file changed

+58
-54
lines changed

1 file changed

+58
-54
lines changed

lectures/harrison_kreps.md

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ jupytext:
33
text_representation:
44
extension: .md
55
format_name: myst
6-
format_version: 0.13
7-
jupytext_version: 1.17.1
86
kernelspec:
9-
name: python3
10-
display_name: Python 3 (ipykernel)
7+
display_name: Python 3
118
language: python
9+
name: python3
1210
---
1311

1412
(harrison_kreps)=
@@ -31,9 +29,10 @@ kernelspec:
3129

3230
In addition to what's in Anaconda, this lecture uses following libraries:
3331

34-
```{code-cell} ipython3
35-
:tags: [hide-output]
36-
32+
```{code-cell} ipython
33+
---
34+
tags: [hide-output]
35+
---
3736
!pip install quantecon
3837
```
3938

@@ -52,10 +51,9 @@ The model features
5251

5352
Let's start with some standard imports:
5453

55-
```{code-cell} ipython3
56-
import numpy as np
54+
```{code-cell} ipython
5755
import quantecon as qe
58-
import scipy.linalg as la
56+
import jax.numpy as jnp
5957
```
6058

6159
### References
@@ -73,7 +71,7 @@ The Harrison-Kreps model illustrates the following notion of a bubble that attra
7371

7472
> *A component of an asset price can be interpreted as a bubble when all investors agree that the current price of the asset exceeds what they believe the asset's underlying dividend stream justifies*.
7573
76-
## Structure of the Model
74+
## Structure of the model
7775

7876
The model simplifies things by ignoring alterations in the distribution of wealth
7977
among investors who have hard-wired different beliefs about the fundamentals that determine
@@ -133,8 +131,8 @@ But in state $1$, a type $a$ investor is more pessimistic about next period's
133131
The stationary (i.e., invariant) distributions of these two matrices can be calculated as follows:
134132

135133
```{code-cell} ipython3
136-
qa = np.array([[1/2, 1/2], [2/3, 1/3]])
137-
qb = np.array([[2/3, 1/3], [1/4, 3/4]])
134+
qa = jnp.array([[1/2, 1/2], [2/3, 1/3]])
135+
qb = jnp.array([[2/3, 1/3], [1/4, 3/4]])
138136
mca = qe.MarkovChain(qa)
139137
mcb = qe.MarkovChain(qb)
140138
mca.stationary_distributions
@@ -150,7 +148,7 @@ The stationary distribution of $P_b$ is approximately $\pi_b = \begin{bmatrix} .
150148

151149
Thus, a type $a$ investor is more pessimistic on average.
152150

153-
### Ownership Rights
151+
### Ownership rights
154152

155153
An owner of the asset at the end of time $t$ is entitled to the dividend at time $t+1$ and also has the right to sell the asset at time $t+1$.
156154

@@ -167,23 +165,23 @@ Case 1 is the case studied in Harrison and Kreps.
167165

168166
In case 2, both types of investors always hold at least some of the asset.
169167

170-
### Short Sales Prohibited
168+
### Short sales prohibited
171169

172170
No short sales are allowed.
173171

174172
This matters because it limits how pessimists can express their opinions.
175173

176-
* They **can** express themselves by selling their shares.
177-
* They **cannot** express themsevles more loudly by artificially "manufacturing shares" -- that is, they cannot borrow shares from more optimistic investors and then immediately sell them.
174+
* They *can* express themselves by selling their shares.
175+
* They *cannot* express themsevles more loudly by artificially "manufacturing shares" -- that is, they cannot borrow shares from more optimistic investors and then immediately sell them.
178176

179-
### Optimism and Pessimism
177+
### Optimism and pessimism
180178

181179
The above specifications of the perceived transition matrices $P_a$ and $P_b$, taken directly from Harrison and Kreps, build in stochastically alternating temporary optimism and pessimism.
182180

183181
Remember that state $1$ is the high dividend state.
184182

185183
* In state $0$, a type $a$ agent is more optimistic about next period's dividend than a type $b$ agent.
186-
* In state $1$, a type $b$ agent is more optimistic about next period's dividend than a type $a$ agaub is.
184+
* In state $1$, a type $b$ agent is more optimistic about next period's dividend than a type $a$ agnet is.
187185

188186
However, the stationary distributions $\pi_a = \begin{bmatrix} .57 & .43 \end{bmatrix}$ and $\pi_b = \begin{bmatrix} .43 & .57 \end{bmatrix}$ tell us that a type $b$ person is more optimistic about the dividend process in the long run than is a type $a$ person.
189187

@@ -195,7 +193,7 @@ This price function is endogenous and to be determined below.
195193

196194
When investors choose whether to purchase or sell the asset at $t$, they also know $s_t$.
197195

198-
## Solving the Model
196+
## Solving the model
199197

200198
Now let's turn to solving the model.
201199

@@ -208,7 +206,7 @@ assumptions about beliefs:
208206
1. There are two types of agents differentiated only by their beliefs. Each type of agent has sufficient resources to purchase all of the asset (Harrison and Kreps's setting).
209207
1. There are two types of agents with different beliefs, but because of limited wealth and/or limited leverage, both types of investors hold the asset each period.
210208

211-
### Summary Table
209+
### Summary table
212210

213211
The following table gives a summary of the findings obtained in the remainder of the lecture
214212
(in an exercise you will be asked to recreate the table and also reinterpret parts of it).
@@ -242,7 +240,7 @@ The row corresponding to $p_p$ would apply if neither type of investor has enoug
242240

243241
The row corresponding to $p_p$ would also apply if both types have enough resources to buy the entire stock of the asset but short sales are also possible so that temporarily pessimistic investors price the asset.
244242

245-
### Single Belief Prices
243+
### Single belief prices
246244

247245
We’ll start by pricing the asset under homogeneous beliefs.
248246

@@ -277,15 +275,17 @@ def price_single_beliefs(transition, dividend_payoff, β=.75):
277275
Function to Solve Single Beliefs
278276
"""
279277
# First compute inverse piece
280-
imbq_inv = la.inv(np.eye(transition.shape[0]) - β * transition)
278+
imbq_inv = jnp.linalg.inv(
279+
jnp.eye(transition.shape[0]) - β * transition
280+
)
281281
282282
# Next compute prices
283283
prices = β * imbq_inv @ transition @ dividend_payoff
284284
285285
return prices
286286
```
287287
288-
#### Single Belief Prices as Benchmarks
288+
#### Single belief prices as benchmarks
289289
290290
These equilibrium prices under homogeneous beliefs are important benchmarks for the subsequent analysis.
291291
@@ -294,7 +294,7 @@ These equilibrium prices under homogeneous beliefs are important benchmarks for
294294
295295
We will compare these fundamental values of the asset with equilibrium values when traders have different beliefs.
296296
297-
### Pricing under Heterogeneous Beliefs
297+
### Pricing under heterogeneous beliefs
298298
299299
There are several cases to consider.
300300
@@ -334,7 +334,7 @@ P_a(s,1) \bar p(0) + P_a(s,1) ( 1 + \bar p(1)) <
334334
P_b(s,1) \bar p(0) + P_b(s,1) ( 1 + \bar p(1))
335335
$$
336336
337-
**Thus the marginal investor is the (temporarily) optimistic type**.
337+
*Thus the marginal investor is the (temporarily) optimistic type*.
338338
339339
Equation {eq}`hakr2` is a functional equation that, like a Bellman equation, can be solved by
340340
@@ -407,31 +407,31 @@ def price_optimistic_beliefs(transitions, dividend_payoff, β=.75,
407407
Function to Solve Optimistic Beliefs
408408
"""
409409
# We will guess an initial price vector of [0, 0]
410-
p_new = np.array([[0], [0]])
411-
p_old = np.array([[10.], [10.]])
410+
p_new = jnp.array([[0], [0]])
411+
p_old = jnp.array([[10.], [10.]])
412412
413413
# We know this is a contraction mapping, so we can iterate to conv
414414
for i in range(max_iter):
415415
p_old = p_new
416-
p_new = β * np.max([q @ p_old
417-
+ q @ dividend_payoff for q in transitions],
418-
axis=0)
416+
p_new = β * jnp.max(jnp.stack([q @ p_old
417+
+ q @ dividend_payoff for q in transitions]),
418+
1)
419419
420420
# If we succeed in converging, break out of for loop
421-
if np.max(np.sqrt((p_new - p_old)**2)) < tol:
421+
if jnp.max(jnp.sqrt((p_new - p_old)**2)) < tol:
422422
break
423423
424-
ptwiddle = β * np.min([q @ p_old
425-
+ q @ dividend_payoff for q in transitions],
424+
ptwiddle = β * jnp.min(jnp.stack([q @ p_old
425+
+ q @ dividend_payoff for q in transitions]),
426426
axis=0)
427427
428-
phat_a = np.array([p_new[0], ptwiddle[1]])
429-
phat_b = np.array([ptwiddle[0], p_new[1]])
428+
phat_a = jnp.array([p_new[0], ptwiddle[1]])
429+
phat_b = jnp.array([ptwiddle[0], p_new[1]])
430430
431431
return p_new, phat_a, phat_b
432432
```
433433
434-
### Insufficient Funds
434+
### Insufficient funds
435435
436436
Outcomes differ when the more optimistic type of investor has insufficient wealth --- or insufficient ability to borrow enough --- to hold the entire stock of the asset.
437437
@@ -445,8 +445,8 @@ Instead of equation {eq}`hakr2`, the equilibrium price satisfies
445445
\check p(s)
446446
= \beta \min
447447
\left\{
448-
P_a(s,0) \check p(0) + P_a(s,1) ( 1 + \check p(1)) ,\;
449-
P_b(s,0) \check p(0) + P_b(s,1) ( 1 + \check p(1))
448+
P_a(s,1) \check p(0) + P_a(s,1) ( 1 + \check p(1)) ,\;
449+
P_b(s,1) \check p(0) + P_b(s,1) ( 1 + \check p(1))
450450
\right\}
451451
```
452452
@@ -475,24 +475,24 @@ def price_pessimistic_beliefs(transitions, dividend_payoff, β=.75,
475475
Function to Solve Pessimistic Beliefs
476476
"""
477477
# We will guess an initial price vector of [0, 0]
478-
p_new = np.array([[0], [0]])
479-
p_old = np.array([[10.], [10.]])
478+
p_new = jnp.array([[0], [0]])
479+
p_old = jnp.array([[10.], [10.]])
480480
481481
# We know this is a contraction mapping, so we can iterate to conv
482482
for i in range(max_iter):
483483
p_old = p_new
484-
p_new = β * np.min([q @ p_old
485-
+ q @ dividend_payoff for q in transitions],
486-
axis=0)
484+
p_new = β * jnp.min(jnp.stack([q @ p_old
485+
+ q @ dividend_payoff for q in transitions]),
486+
axis=0)
487487
488488
# If we succeed in converging, break out of for loop
489-
if np.max(np.sqrt((p_new - p_old)**2)) < tol:
489+
if jnp.max(jnp.sqrt((p_new - p_old)**2)) < tol:
490490
break
491491
492492
return p_new
493493
```
494494
495-
### Further Interpretation
495+
### Further interpretation
496496
497497
Jose Scheinkman {cite}`Scheinkman2014` interprets the Harrison-Kreps model as a model of a bubble --- a situation in which an asset price exceeds what every investor thinks is merited by his or her beliefs about the value of the asset's underlying dividend stream.
498498
@@ -513,6 +513,8 @@ Scheinkman extracts insights about the effects of financial regulations on bubbl
513513
514514
He emphasizes how limiting short sales and limiting leverage have opposite effects.
515515
516+
## Exercises
517+
516518
```{exercise-start}
517519
:label: hk_ex1
518520
```
@@ -570,22 +572,24 @@ First, we will obtain equilibrium price vectors with homogeneous beliefs, includ
570572
investors are optimistic or pessimistic.
571573
572574
```{code-cell} ipython3
573-
qa = np.array([[1/2, 1/2], [2/3, 1/3]]) # Type a transition matrix
574-
qb = np.array([[2/3, 1/3], [1/4, 3/4]]) # Type b transition matrix
575+
qa = jnp.array([[1/2, 1/2], [2/3, 1/3]]) # Type a transition matrix
576+
qb = jnp.array([[2/3, 1/3], [1/4, 3/4]]) # Type b transition matrix
575577
# Optimistic investor transition matrix
576-
qopt = np.array([[1/2, 1/2], [1/4, 3/4]])
578+
qopt = jnp.array([[1/2, 1/2], [1/4, 3/4]])
577579
# Pessimistic investor transition matrix
578-
qpess = np.array([[2/3, 1/3], [2/3, 1/3]])
580+
qpess = jnp.array([[2/3, 1/3], [2/3, 1/3]])
579581
580-
dividendreturn = np.array([[0], [1]])
582+
dividendreturn = jnp.array([[0], [1]])
581583
582584
transitions = [qa, qb, qopt, qpess]
583585
labels = ['p_a', 'p_b', 'p_optimistic', 'p_pessimistic']
584586
585587
for transition, label in zip(transitions, labels):
586588
print(label)
587589
print("=" * 20)
588-
s0, s1 = np.round(price_single_beliefs(transition, dividendreturn), 2)
590+
s0, s1 = jnp.round(
591+
price_single_beliefs(transition, dividendreturn), 2
592+
)
589593
print(f"State 0: {s0}")
590594
print(f"State 1: {s1}")
591595
print("-" * 20)
@@ -601,7 +605,7 @@ labels = ['p_optimistic', 'p_hat_a', 'p_hat_b']
601605
for p, label in zip(opt_beliefs, labels):
602606
print(label)
603607
print("=" * 20)
604-
s0, s1 = np.round(p, 2)
608+
s0, s1 = jnp.round(p, 2)
605609
print(f"State 0: {s0}")
606610
print(f"State 1: {s1}")
607611
print("-" * 20)
@@ -613,4 +617,4 @@ with **permanently optimistic** investors - this is due to the marginal investor
613617
```{solution-end}
614618
```
615619
616-
[^f1]: By assuming that both types of agents always have "deep enough pockets" to purchase all of the asset, the model takes wealth dynamics off the table. The Harrison-Kreps model generates high trading volume when the state changes either from 0 to 1 or from 1 to 0.
620+
[^f1]: By assuming that both types of agents always have "deep enough pockets" to purchase all of the asset, the model takes wealth dynamics off the table. The Harrison-Kreps model generates high trading volume when the state changes either from 0 to 1 or from 1 to 0.

0 commit comments

Comments
 (0)