Skip to content

Commit 12c5804

Browse files
authored
misc (#254)
1 parent 4bb01d6 commit 12c5804

File tree

1 file changed

+49
-27
lines changed

1 file changed

+49
-27
lines changed

lectures/commod_price.md

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,58 @@ kernelspec:
99
name: python3
1010
---
1111

12-
For this lecture we need the `yfinance` library.
1312

14-
```{code-cell} ipython3
15-
:tags: [hide-output]
16-
!pip install yfinance
17-
```
1813

1914

2015
# Commodity Prices
2116

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
2318

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).
2420

2521
Examples of commodities include copper, diamonds, iron ore, lithium, cotton
2622
and coffee beans.
2723

2824
In this lecture we give an introduction to the theory of commodity prices.
2925

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.
3139

3240
```{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+
3447

48+
```{code-cell} ipython3
49+
import numpy as np
3550
import yfinance as yf
3651
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+
3764
s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
3865
```
3966

@@ -51,11 +78,18 @@ plt.show()
5178

5279
The figure shows surprisingly large movements in the price of cotton.
5380

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.
5688

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*.
5993

6094
This model was developed by
6195
{cite}`samuelson1971stochastic`,
@@ -65,8 +99,8 @@ This model was developed by
6599

66100

67101

68-
## Outline
69102

103+
## The competitive storage model
70104

71105
In the competitive storage model, commodities are assets that
72106

@@ -91,16 +125,6 @@ The equilibrium price is determined competitively.
91125
It is a function of the current state (which determines
92126
current harvests and predicts future harvests).
93127

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-
```
104128

105129

106130
## The model
@@ -113,8 +137,6 @@ The harvest of the commodity at time $t$ is $Z_t$.
113137
We assume that the sequence $\{ Z_t \}_{t \geq 1}$ is IID with common
114138
density function $\phi$.
115139

116-
The harvests take values in $S$, a subset of the nonnegative numbers.
117-
118140
Speculators can store the commodity between periods, with $I_t$ units
119141
purchased in the current period yielding $\alpha I_t$ units in the next.
120142

@@ -176,7 +198,7 @@ Regarding quantities,
176198
177199
Mathematically,
178200
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
180202
* demand $ = D(p_t) + I_t$
181203
182204
Thus, the market equilibrium condition is
@@ -193,7 +215,7 @@ The initial condition $X_0 \in S$ is treated as given.
193215
194216
### An equilibrium function
195217
196-
Now to find an equilibrium?
218+
How can we find an equilibrium?
197219
198220
Our path of attack will be to seek a system of prices that depend only on the
199221
current state.

0 commit comments

Comments
 (0)