Skip to content

Commit a5e51fe

Browse files
jstacclaude
andcommitted
Fix Cauchy reproducibility, LLN figure, and exercise numbering
- Pass random_state=rng to cauchy().rvs() in the draws-normal-cauchy figure so the Cauchy draws are reproducible. - Change LLN failure seed from 1234 to 9403 so the sample mean clearly fails to converge: it stays near zero for 700+ observations then spikes, matching the original figure's pedagogical pattern. - Fix stale "Repeat exercise 1" reference to use {numref}`draws-normal-cauchy`. - Rename ht_ex5 → ht_ex4 to match its rendered position as Exercise 22.4. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d22033f commit a5e51fe

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lectures/heavy_tails.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ for ax, s in zip(axes[:2], s_vals):
366366
367367
ax = axes[2]
368368
distribution = cauchy()
369-
data = distribution.rvs(n)
369+
data = distribution.rvs(n, random_state=rng)
370370
ax.plot(list(range(n)), data, linestyle='', marker='o', alpha=0.5, ms=4)
371371
ax.vlines(list(range(n)), 0, data, lw=0.2)
372372
ax.set_title(f"draws from the Cauchy distribution", fontsize=11)
@@ -979,7 +979,7 @@ mystnb:
979979
---
980980
from scipy.stats import cauchy
981981
982-
rng = np.random.default_rng(1234)
982+
rng = np.random.default_rng(9403)
983983
N = 1_000
984984
985985
distribution = cauchy()
@@ -1195,7 +1195,7 @@ Since $r \geq \alpha$, we have $\mathbb E X^r = \infty$.
11951195
```{exercise}
11961196
:label: ht_ex3
11971197
1198-
Repeat exercise 1, but replace the three distributions (two normal, one
1198+
Repeat the simulation in {numref}`draws-normal-cauchy`, but replace the three distributions (two normal, one
11991199
Cauchy) with three Pareto distributions using different choices of
12001200
$\alpha$.
12011201
@@ -1236,7 +1236,7 @@ plt.show()
12361236

12371237

12381238
```{exercise}
1239-
:label: ht_ex5
1239+
:label: ht_ex4
12401240
12411241
There is an ongoing argument about whether the firm size distribution should
12421242
be modeled as a Pareto distribution or a lognormal distribution (see, e.g.,
@@ -1290,7 +1290,7 @@ try to track individual firms given the current distribution. We will discuss
12901290
firm dynamics in later lectures.)
12911291
```
12921292

1293-
```{solution-start} ht_ex5
1293+
```{solution-start} ht_ex4
12941294
:class: dropdown
12951295
```
12961296

0 commit comments

Comments
 (0)