You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/cobweb.md
+32-49Lines changed: 32 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ jupytext:
4
4
extension: .md
5
5
format_name: myst
6
6
format_version: 0.13
7
-
jupytext_version: 1.14.1
7
+
jupytext_version: 1.16.2
8
8
kernelspec:
9
9
display_name: Python 3 (ipykernel)
10
10
language: python
@@ -14,7 +14,6 @@ kernelspec:
14
14
(cobweb)=
15
15
# The Cobweb Model
16
16
17
-
18
17
The cobweb model is a model of prices and quantities in a given market, and how they evolve over time.
19
18
20
19
## Overview
@@ -24,7 +23,7 @@ because it shows the fundamental importance of *expectations*.
24
23
25
24
To give some idea of how the model operates, and why expectations matter, imagine the following scenario.
26
25
27
-
There is a market for soy beans, say, where prices and traded quantities
26
+
There is a market for soybeans, say, where prices and traded quantities
28
27
depend on the choices of buyers and sellers.
29
28
30
29
The buyers are represented by a demand curve --- they buy more at low prices
@@ -38,11 +37,11 @@ However, the sellers (who are farmers) need time to grow their crops.
38
37
Suppose now that the price is currently high.
39
38
40
39
Seeing this high price, and perhaps expecting that the high price will remain
41
-
for some time, the farmers plant many fields with soy beans.
40
+
for some time, the farmers plant many fields with soybeans.
42
41
43
42
Next period the resulting high supply floods the market, causing the price to drop.
44
43
45
-
Seeing this low price, the farmers now shift out of soy beans, restricting
44
+
Seeing this low price, the farmers now shift out of soybeans, restricting
46
45
supply and causing the price to climb again.
47
46
48
47
You can imagine how these dynamics could cause cycles in prices and quantities
@@ -52,13 +51,10 @@ The cobweb model puts these ideas into equations so we can try to quantify
52
51
them, and to study conditions under which cycles persist (or disappear).
53
52
54
53
In this lecture, we investigate and simulate the basic model under different
55
-
assumptions regarding the way that produces form expectations.
54
+
assumptions regarding the way that producers form expectations.
56
55
57
56
Our discussion and simulations draw on [high quality lectures](https://comp-econ.org/CEF_2013/downloads/Complex%20Econ%20Systems%20Lecture%20II.pdf) by [Cars Hommes](https://www.uva.nl/en/profile/h/o/c.h.hommes/c.h.hommes.html).
58
57
59
-
60
-
+++
61
-
62
58
We will use the following imports.
63
59
64
60
```{code-cell} ipython3
@@ -70,7 +66,7 @@ import matplotlib.pyplot as plt
70
66
71
67
Early papers on the cobweb cycle include {cite}`cobweb_model` and {cite}`hog_cycle`.
72
68
73
-
The paper {cite}`hog_cycle` uses the cobweb theorem to explain the prices of hog in the US over 1920--1950
69
+
The paper {cite}`hog_cycle` uses the cobweb theorem to explain the prices of hog in the US over 1920--1950.
74
70
75
71
The next plot replicates part of Figure 2 from that paper, which plots the price of hogs at yearly frequency.
76
72
@@ -90,13 +86,11 @@ ax.grid()
90
86
plt.show()
91
87
```
92
88
93
-
94
-
95
89
## The model
96
90
97
-
Let's return to our discussion of a hypothetical soy bean market, where price is determined by supply and demand.
91
+
Let's return to our discussion of a hypothetical soybean market, where price is determined by supply and demand.
98
92
99
-
We suppose that demand for soy beans is given by
93
+
We suppose that demand for soybeans is given by
100
94
101
95
$$
102
96
D(p_t) = a - b p_t
@@ -106,15 +100,15 @@ where $a, b$ are nonnegative constants and $p_t$ is the spot (i.e, current marke
106
100
107
101
($D(p_t)$ is the quantity demanded in some fixed unit, such as thousands of tons.)
108
102
109
-
Because the crop of soy beans for time $t$ is planted at $t-1$, supply of soy beans at time $t$ depends on *expected* prices at time $t$, which we denote $p^e_{t-1}$.
103
+
Because the crop of soybeans for time $t$ is planted at $t-1$, supply of soybeans at time $t$ depends on *expected* prices at time $t$, which we denote $p^e_t$.
110
104
111
105
We suppose that supply is nonlinear in expected prices, and takes the form
112
106
113
107
$$
114
-
S(p^e_{t-1}) = \tanh(\lambda(p^e_{t-1} - c)) + d
108
+
S(p^e_t) = \tanh(\lambda(p^e_t - c)) + d
115
109
$$
116
110
117
-
where $\lambda$ is a positive constant and $c, d \geq 0$.
111
+
where $\lambda$ is a positive constant, $c, d$ are nonnegative constants and $\tanh$ is a type of [hyperbolic function](https://en.wikipedia.org/wiki/Hyperbolic_functions).
118
112
119
113
Let's make a plot of supply and demand for particular choices of the parameter values.
120
114
@@ -149,7 +143,7 @@ m = Market()
149
143
fig, ax = plt.subplots()
150
144
151
145
ax.plot(p_grid, m.demand(p_grid), label="$D$")
152
-
ax.plot(p_grid, m.supply(p_grid), label="S")
146
+
ax.plot(p_grid, m.supply(p_grid), label="$S$")
153
147
ax.set_xlabel("price")
154
148
ax.set_ylabel("quantity")
155
149
ax.legend()
@@ -160,13 +154,13 @@ plt.show()
160
154
Market equilibrium requires that supply equals demand, or
161
155
162
156
$$
163
-
a - b p_t = S(p^e_{t-1})
157
+
a - b p_t = S(p^e_t)
164
158
$$
165
159
166
160
Rewriting in terms of $p_t$ gives
167
161
168
162
$$
169
-
p_t = - \frac{1}{b} [S(p^e_{t-1}) - a]
163
+
p_t = - \frac{1}{b} [S(p^e_t) - a]
170
164
$$
171
165
172
166
Finally, to complete the model, we need to describe how price expectations are formed.
@@ -177,7 +171,7 @@ In particular, we suppose that
177
171
178
172
```{math}
179
173
:label: p_et
180
-
p^e_{t-1} = f(p_{t-1}, p_{t-2})
174
+
p^e_t = f(p_{t-1}, p_{t-2})
181
175
```
182
176
183
177
where $f$ is some function.
@@ -195,7 +189,6 @@ Combining the last two equations gives the dynamics for prices:
195
189
196
190
The price dynamics depend on the parameter values and also on the function $f$ that determines how producers form expectations.
197
191
198
-
199
192
## Naive expectations
200
193
201
194
To go further in our analysis we need to specify the function $f$; that is, how expectations are formed.
@@ -204,7 +197,9 @@ Let's start with naive expectations, which refers to the case where producers ex
204
197
205
198
In other words,
206
199
207
-
$$ p_{t-1}^e = p_{t-1} $$
200
+
$$
201
+
p_t^e = p_{t-1}
202
+
$$
208
203
209
204
Using {eq}`price_t`, we then have
210
205
@@ -225,7 +220,6 @@ where $g$ is the function defined by
225
220
g(p) = - \frac{1}{b} [ S(p) - a]
226
221
```
227
222
228
-
229
223
Here we represent the function $g$
230
224
231
225
```{code-cell} ipython3
@@ -239,9 +233,9 @@ def g(model, current_price):
239
233
return next_price
240
234
```
241
235
242
-
Let's try to understand how prices will evolve using a 45degree diagram, which is a tool for studying one-dimensional dynamics.
236
+
Let's try to understand how prices will evolve using a 45-degree diagram, which is a tool for studying one-dimensional dynamics.
243
237
244
-
The function `plot45` defined below helps us draw the 45degree diagram.
238
+
The function `plot45` defined below helps us draw the 45-degree diagram.
0 commit comments