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
+57-38Lines changed: 57 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@ jupytext:
3
3
text_representation:
4
4
extension: .md
5
5
format_name: myst
6
+
format_version: 0.13
7
+
jupytext_version: 1.14.1
6
8
kernelspec:
7
9
display_name: Python 3 (ipykernel)
8
10
language: python
@@ -13,9 +15,11 @@ kernelspec:
13
15
# The Cobweb Model
14
16
15
17
16
-
The cobweb model {cite}`cobweb_model`is a model of prices and quantities in a given market, and how they evolve over time.
18
+
The cobweb model is a model of prices and quantities in a given market, and how they evolve over time.
17
19
18
-
The model dates back to the 1930s and, while simple, it remains significant
20
+
## Overview
21
+
22
+
The cobweb model dates back to the 1930s and, while simple, it remains significant
19
23
because it shows the fundamental importance of *expectations*.
20
24
21
25
To give some idea of how the model operates, and why expectations matter, imagine the following scenario.
@@ -44,49 +48,54 @@ supply and causing the price to climb again.
44
48
You can imagine how these dynamics could cause cycles in prices and quantities
45
49
that persist over time.
46
50
47
-
This motivation is also taken from one of the earliest papers that uses
48
-
cobweb theorem to explain the prices of hog in the US. We will try to
49
-
simulate and plot the graph that uses the rough data from the paper {cite}`hog_cycle`.
51
+
The cobweb model puts these ideas into equations so we can try to quantify
52
+
them, and to study conditions underw which cycles persist (or disappear).
50
53
51
-
We will use the following imports:
54
+
In this lecture, we investigate and simulate the basic model under different
55
+
assumptions regarding the way that produces form expectations.
56
+
57
+
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
+
59
+
60
+
+++
61
+
62
+
We will use the following imports.
52
63
53
64
```{code-cell} ipython3
54
65
import numpy as np
55
66
import matplotlib.pyplot as plt
56
67
```
57
68
58
-
We will use the following data for simulation:
69
+
## History
70
+
71
+
Early papers on the cobweb cycle include {cite}`cobweb_model` and {cite}`hog_cycle`.
72
+
73
+
The paper {cite}`hog_cycle` uses the cobweb theorem to explain the prices of hog in the US over 1920--1950
74
+
75
+
The next plot replicates part of Figure 2 from that paper, which plots the price of hogs at yearly frequency.
76
+
77
+
Notice the cyclical price dynamics, which match the kind of cyclical soybean price dynamics discussed above.
The cobweb model puts these ideas into equations so we can try to quantify
79
-
them, and to study conditions underw which cycles persist (or disappear).
80
-
81
-
In this lecture, we investigate and simulate the basic model under different
82
-
assumptions regarding the way that produces form expectations.
83
-
84
-
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).
85
-
86
93
87
94
88
95
## The Model
89
96
97
+
Let's return to our discussion of a hypothetical soy bean market, where price is determined by supply and demand.
98
+
90
99
We suppose that demand for soy beans is given by
91
100
92
101
$$
@@ -97,7 +106,7 @@ where $a, b$ are nonnegative constants and $p_t$ is the spot (i.e, current marke
97
106
98
107
($D(p_t)$ is the quantity demanded in some fixed unit, such as thousands of tons.)
99
108
100
-
Supply of soy beans depends on *expected* prices at time $t$, which we denote $p^e_t$.
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$.
101
110
102
111
We suppose that supply is nonlinear in expected prices, and takes the form
103
112
@@ -236,6 +245,7 @@ The function `plot45` defined below helps us draw the 45 degree diagram.
236
245
237
246
```{code-cell} ipython3
238
247
:tags: [hide-input]
248
+
239
249
def plot45(model, pmin, pmax, p0, num_arrows=5):
240
250
"""
241
251
Function to plot a 45 degree plot
@@ -378,7 +388,7 @@ The cycle is "stable", in the sense that prices converge to it from most startin
378
388
379
389
For example,
380
390
381
-
```{code-cell} ipython3 tags=[]
391
+
```{code-cell} ipython3
382
392
ts_plot_price(m, 10, ts_length=15)
383
393
```
384
394
@@ -456,7 +466,6 @@ Let's call the function with prices starting at $p_0 = 5$.
456
466
457
467
TODO does this fit well in the page, even in the pdf? If not should it be stacked vertically?
458
468
459
-
460
469
```{code-cell} ipython3
461
470
ts_price_plot_adaptive(m, 5, ts_length=30)
462
471
```
@@ -476,7 +485,7 @@ TODO check / fix exercises
476
485
```{exercise-start}
477
486
:label: cobweb_ex1
478
487
```
479
-
Using the default Market model and naive expectations, plot a time series simulation of supply (rather than the price).
488
+
Using the default `Market` class and naive expectations, plot a time series simulation of supply (rather than the price).
0 commit comments