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/commod_price.md
+49-27Lines changed: 49 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -9,31 +9,58 @@ kernelspec:
9
9
name: python3
10
10
---
11
11
12
-
For this lecture we need the `yfinance` library.
13
12
14
-
```{code-cell} ipython3
15
-
:tags: [hide-output]
16
-
!pip install yfinance
17
-
```
18
13
19
14
20
15
# Commodity Prices
21
16
22
-
For more than half of all countries around the globe, [commodities](https://en.wikipedia.org/wiki/Commodity) account for [the majority of total exports](https://unctad.org/publication/commodities-and-development-report-2019).
17
+
## Outline
23
18
19
+
For more than half of all countries around the globe, [commodities](https://en.wikipedia.org/wiki/Commodity) account for [the majority of total exports](https://unctad.org/publication/commodities-and-development-report-2019).
24
20
25
21
Examples of commodities include copper, diamonds, iron ore, lithium, cotton
26
22
and coffee beans.
27
23
28
24
In this lecture we give an introduction to the theory of commodity prices.
29
25
30
-
The figure below shows the price of cotton in USD since the start of 2016.
26
+
The lecture is quite advanced relative to other lectures in this series.
27
+
28
+
We need to compute an equilibrium, and that equilibrium is described by a
29
+
price function.
30
+
31
+
We will solve an equation where the price function is the unknown.
32
+
33
+
This is harder than solving an equation for an unknown number, or vector.
34
+
35
+
The lecture will discuss one way to solve a "functional equation" for an unknown
36
+
function
37
+
38
+
For this lecture we need the `yfinance` library.
31
39
32
40
```{code-cell} ipython3
33
-
:tags: [hide-input, hide-output]
41
+
:tags: [hide-output]
42
+
!pip install yfinance
43
+
```
44
+
45
+
We will use the following imports
46
+
34
47
48
+
```{code-cell} ipython3
49
+
import numpy as np
35
50
import yfinance as yf
36
51
import matplotlib.pyplot as plt
52
+
from scipy.interpolate import interp1d
53
+
from scipy.optimize import minimize_scalar, brentq
54
+
from scipy.stats import beta
55
+
```
56
+
57
+
## Data
58
+
59
+
The figure below shows the price of cotton in USD since the start of 2016.
60
+
61
+
```{code-cell} ipython3
62
+
:tags: [hide-input, hide-output]
63
+
37
64
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
38
65
```
39
66
@@ -51,11 +78,18 @@ plt.show()
51
78
52
79
The figure shows surprisingly large movements in the price of cotton.
53
80
54
-
In general, prices depend on the choices and actions of suppliers, consumers and
55
-
speculators.
81
+
What causes these movements?
82
+
83
+
In general, prices depend on the choices and actions of
84
+
85
+
1. suppliers,
86
+
2. consumers, and
87
+
3. speculators.
56
88
57
-
Our focus will be on the interaction between these parties, viewed through the
58
-
lens of the standard competitive storage model
89
+
Our focus will be on the interaction between these parties.
90
+
91
+
We will connect them together in a dynamic model of supply and demand, called
92
+
the *competitive storage model*.
59
93
60
94
This model was developed by
61
95
{cite}`samuelson1971stochastic`,
@@ -65,8 +99,8 @@ This model was developed by
65
99
66
100
67
101
68
-
## Outline
69
102
103
+
## The competitive storage model
70
104
71
105
In the competitive storage model, commodities are assets that
72
106
@@ -91,16 +125,6 @@ The equilibrium price is determined competitively.
91
125
It is a function of the current state (which determines
92
126
current harvests and predicts future harvests).
93
127
94
-
We begin with the following imports
95
-
96
-
97
-
```{code-cell} ipython3
98
-
import numpy as np
99
-
import matplotlib.pyplot as plt
100
-
from scipy.interpolate import interp1d
101
-
from scipy.optimize import minimize_scalar, brentq
102
-
from scipy.stats import beta
103
-
```
104
128
105
129
106
130
## The model
@@ -113,8 +137,6 @@ The harvest of the commodity at time $t$ is $Z_t$.
113
137
We assume that the sequence $\{ Z_t \}_{t \geq 1}$ is IID with common
114
138
density function $\phi$.
115
139
116
-
The harvests take values in $S$, a subset of the nonnegative numbers.
117
-
118
140
Speculators can store the commodity between periods, with $I_t$ units
119
141
purchased in the current period yielding $\alpha I_t$ units in the next.
120
142
@@ -176,7 +198,7 @@ Regarding quantities,
176
198
177
199
Mathematically,
178
200
179
-
* supply $ = X_t = \alpha I_{t-1} + Z_t$
201
+
* supply $ = X_t = \alpha I_{t-1} + Z_t$, which takes values in $S := \mathbb R_+$, while
180
202
* demand $ = D(p_t) + I_t$
181
203
182
204
Thus, the market equilibrium condition is
@@ -193,7 +215,7 @@ The initial condition $X_0 \in S$ is treated as given.
193
215
194
216
### An equilibrium function
195
217
196
-
Now to find an equilibrium?
218
+
How can we find an equilibrium?
197
219
198
220
Our path of attack will be to seek a system of prices that depend only on the
0 commit comments