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
* [commod_price] Update editorial suggestions
* [commod_price] Update the internal link
* [commod_price] Update the plotting code
* [commod_price] Update code
* Update commod_price.md
* fix a small typo in doc ref
* Update lectures/commod_price.md
Co-authored-by: Matt McKay <[email protected]>
* Update lectures/monte_carlo.md
Co-authored-by: Matt McKay <[email protected]>
* Update the link of Monte Carlo
* Update commod_price.md
* misc
---------
Co-authored-by: Humphrey Yang <[email protected]>
Co-authored-by: Matt McKay <[email protected]>
Co-authored-by: John Stachurski <[email protected]>
Copy file name to clipboardExpand all lines: lectures/commod_price.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,7 @@ We will solve an equation where the price function is the unknown.
32
32
33
33
This is harder than solving an equation for an unknown number, or vector.
34
34
35
-
The lecture will discuss one way to solve a "functional equation" for an unknown
36
-
function
35
+
The lecture will discuss one way to solve a [functional equation](https://en.wikipedia.org/wiki/Functional_equation) (an equation where the unknown object is a function).
37
36
38
37
For this lecture we need the `yfinance` library.
39
38
@@ -70,7 +69,7 @@ s = yf.download('CT=F', '2016-1-1', '2023-4-1')['Adj Close']
70
69
fig, ax = plt.subplots()
71
70
72
71
ax.plot(s, marker='o', alpha=0.5, ms=1)
73
-
ax.set_ylabel('price', fontsize=12)
72
+
ax.set_ylabel('cotton price in USD', fontsize=12)
74
73
ax.set_xlabel('date', fontsize=12)
75
74
76
75
plt.show()
@@ -134,13 +133,12 @@ $p_t$.
134
133
135
134
The harvest of the commodity at time $t$ is $Z_t$.
136
135
137
-
We assume that the sequence $\{ Z_t \}_{t \geq 1}$ is IID with common
138
-
density function $\phi$.
136
+
We assume that the sequence $\{ Z_t \}_{t \geq 1}$ is IID with common density function $\phi$, where $\phi$ is nonnegative.
139
137
140
138
Speculators can store the commodity between periods, with $I_t$ units
141
139
purchased in the current period yielding $\alpha I_t$ units in the next.
142
140
143
-
Here $\alpha \in (0,1)$ is a depreciation rate for the commodity.
141
+
Here the parameter $\alpha \in (0,1)$ is a depreciation rate for the commodity.
144
142
145
143
For simplicity, the risk free interest rate is taken to be
146
144
zero, so expected profit on purchasing $I_t$ units is
@@ -175,6 +173,7 @@ $$
175
173
\alpha \mathbb{E}_t \, p_{t+1} - p_t \leq 0
176
174
$$ (eq:arbi)
177
175
176
+
This means that if the expected price is lower than the current price, there is no room for arbitrage.
178
177
179
178
Profit maximization gives the additional condition
180
179
@@ -183,7 +182,7 @@ $$
183
182
$$ (eq:pmco)
184
183
185
184
186
-
We also require that the market clears in each period.
185
+
We also require that the market clears, with supply equaling demand in each period.
187
186
188
187
We assume that consumers generate demand quantity $D(p)$ corresponding to
189
188
price $p$.
@@ -193,12 +192,12 @@ Let $P := D^{-1}$ be the inverse demand function.
193
192
194
193
Regarding quantities,
195
194
196
-
* supply is the sum of carryover by speculators and the current harvest
195
+
* supply is the sum of carryover by speculators and the current harvest, and
197
196
* demand is the sum of purchases by consumers and purchases by speculators.
198
197
199
198
Mathematically,
200
199
201
-
* supply $ = X_t = \alpha I_{t-1} + Z_t$, which takes values in $S := \mathbb R_+$, while
200
+
* supply is given by $X_t = \alpha I_{t-1} + Z_t$, which takes values in $S := \mathbb R_+$, while
202
201
* demand $ = D(p_t) + I_t$
203
202
204
203
Thus, the market equilibrium condition is
@@ -220,6 +219,8 @@ How can we find an equilibrium?
220
219
Our path of attack will be to seek a system of prices that depend only on the
221
220
current state.
222
221
222
+
(Our solution method involves using an [ansatz](https://en.wikipedia.org/wiki/Ansatz), which is an educated guess --- in this case for the price function.)
223
+
223
224
In other words, we take a function $p$ on $S$ and set $p_t = p(X_t)$ for every $t$.
224
225
225
226
Prices and quantities then follow
@@ -235,8 +236,6 @@ conditions above.
235
236
More precisely, we seek a $p$ such that [](eq:arbi) and [](eq:pmco) hold for
236
237
the corresponding system [](eq:eosy).
237
238
238
-
To this end, suppose that there exists a function $p^*$ on $S$
239
-
satisfying
240
239
241
240
$$
242
241
p^*(x) = \max
@@ -285,7 +284,7 @@ But then $D(p^*(X_t)) = X_t$ and $I_t = I(X_t) = 0$.
285
284
286
285
As a consequence, both [](eq:arbi) and [](eq:pmco) hold.
287
286
288
-
We have found an equilibrium.
287
+
We have found an equilibrium, which verifies the ansatz.
289
288
290
289
291
290
### Computing the equilibrium
@@ -347,7 +346,7 @@ The code below implements this iterative process, starting from $p_0 = P$.
347
346
The distribution $\phi$ is set to a shifted Beta distribution (although many
348
347
other choices are possible).
349
348
350
-
The integral in [](eq:dopf3) is computed via Monte Carlo.
349
+
The integral in [](eq:dopf3) is computed via {ref}`Monte Carlo <monte-carlo>`.
0 commit comments