GitHub

@@ -4,7 +4,7 @@ jupytext:

44

extension: .md

55

format_name: myst

66

format_version: 0.13

7-

jupytext_version: 1.14.1

7+

jupytext_version: 1.16.2

88

kernelspec:

99

display_name: Python 3 (ipykernel)

1010

language: python

@@ -56,7 +56,6 @@ assumptions regarding the way that producers form expectations.

56565757

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

585859-6059

+++

61606261

We will use the following imports.

@@ -90,8 +89,6 @@ ax.grid()

9089

plt.show()

9190

```

929193-94-9592

## The model

96939794

Let's return to our discussion of a hypothetical soybean market, where price is determined by supply and demand.

@@ -106,12 +103,12 @@ where $a, b$ are nonnegative constants and $p_t$ is the spot (i.e, current marke

106103107104

($D(p_t)$ is the quantity demanded in some fixed unit, such as thousands of tons.)

108105109-

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^t_{t-1}$.

106+

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

110107111108

We suppose that supply is nonlinear in expected prices, and takes the form

112109113110

$$

114-

S(p^t_{t-1}) = \tanh(\lambda(p^t_{t-1} - c)) + d

111+

S(p^e_t) = \tanh(\lambda(p^e_t - c)) + d

115112

$$

116113117114

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

@@ -160,13 +157,13 @@ plt.show()

160157

Market equilibrium requires that supply equals demand, or

161158162159

$$

163-

a - b p_t = S(p^t_{t-1})

160+

a - b p_t = S(p^e_t)

164161

$$

165162166163

Rewriting in terms of $p_t$ gives

167164168165

$$

169-

p_t = - \frac{1}{b} [S(p^t_{t-1}) - a]

166+

p_t = - \frac{1}{b} [S(p^e_t) - a]

170167

$$

171168172169

Finally, to complete the model, we need to describe how price expectations are formed.

@@ -177,7 +174,7 @@ In particular, we suppose that

177174178175

```{math}

179176

:label: p_et

180-

p^t_{t-1} = f(p_{t-1}, p_{t-2})

177+

p^e_t = f(p_{t-1}, p_{t-2})

181178

```

182179183180

where $f$ is some function.

@@ -204,7 +201,7 @@ Let's start with naive expectations, which refers to the case where producers ex

204201205202

In other words,

206203207-

$$ p_{t-1}^t = p_{t-1} $$

204+

$$ p_t^e = p_{t-1} $$

208205209206

Using {eq}`price_t`, we then have

210207

@@ -408,15 +405,15 @@ That is,

408405409406

```{math}

410407

:label: pe_adaptive

411-

p_{t-1}^t = \alpha p_{t-1} + (1-\alpha) p^t_{t-2}

408+

p_t^e = \alpha p_{t-1} + (1-\alpha) p^e_{t-1}

412409

\qquad (0 \leq \alpha \leq 1)

413410

```

414411415412

Another way to write this is

416413417414

```{math}

418415

:label: pe_adaptive_2

419-

p_{t-1}^t = p^t_{t-2} + \alpha (p_{t-1} - p_{t-2}^t)

416+

p_t^e = p^e_{t-1} + \alpha (p_{t-1} - p_{t-1}^e)

420417

```

421418422419

This equation helps to show that expectations shift

@@ -427,7 +424,7 @@ This equation helps to show that expectations shift

427424

Using {eq}`pe_adaptive`, we obtain the dynamics

428425429426

$$

430-

p_t = - \frac{1}{b} [ S(\alpha p_{t-1} + (1-\alpha) p^t_{t-2}) - a]

427+

p_t = - \frac{1}{b} [ S(\alpha p_{t-1} + (1-\alpha) p^e_{t-1}) - a]

431428

$$

432429433430

@@ -464,7 +461,6 @@ def ts_price_plot_adaptive(model, p0, ts_length=10, α=[1.0, 0.9, 0.75]):

464461465462

Let's call the function with prices starting at $p_0 = 5$.

466463467-468464

```{code-cell} ipython3

469465

ts_price_plot_adaptive(m, 5, ts_length=30)

470466

```

@@ -545,7 +541,7 @@ That is,

545541546542

```{math}

547543

:label: pe_blae

548-

p_{t-1}^t = \alpha p_{t-1} + (1-\alpha) p_{t-2}

544+

p_t^e = \alpha p_{t-1} + (1-\alpha) p_{t-2}

549545

```

550546551547

@@ -608,4 +604,3 @@ ts_plot_price_blae(m,

608604

```{code-cell} ipython3

609605610606

```

611-

Read the original on github.com ↗