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
Here's another view of draws from the same distribution:
102
108
103
109
```{code-cell} ipython3
110
+
---
111
+
mystnb:
112
+
figure:
113
+
caption: Histogram of observations
114
+
name: hist-obs2
115
+
---
104
116
n = 2000
105
117
fig, ax = plt.subplots()
106
118
data = norm.rvs(size=n)
@@ -174,6 +186,12 @@ data = yf.download('AMZN', '2015-1-1', '2022-7-1')
174
186
```
175
187
176
188
```{code-cell} ipython3
189
+
---
190
+
mystnb:
191
+
figure:
192
+
caption: Daily Amazon returns
193
+
name: dailyreturns-amzn
194
+
---
177
195
s = data['Adj Close']
178
196
r = s.pct_change()
179
197
@@ -194,7 +212,18 @@ Several of observations are quite extreme.
194
212
We get a similar picture if we look at other assets, such as Bitcoin
195
213
196
214
```{code-cell} ipython3
197
-
s = yf.download('BTC-USD', '2015-1-1', '2022-7-1')['Adj Close']
215
+
:tags: [hide-output]
216
+
data = yf.download('BTC-USD', '2015-1-1', '2022-7-1')
217
+
```
218
+
219
+
```{code-cell} ipython3
220
+
---
221
+
mystnb:
222
+
figure:
223
+
caption: Daily Bitcoin returns
224
+
name: dailyreturns-btc
225
+
---
226
+
s = data['Adj Close']
198
227
r = s.pct_change()
199
228
200
229
fig, ax = plt.subplots()
@@ -211,6 +240,12 @@ The histogram also looks different to the histogram of the normal
211
240
distribution:
212
241
213
242
```{code-cell} ipython3
243
+
---
244
+
mystnb:
245
+
figure:
246
+
caption: Histogram (Normal vs Bitcoin returns)
247
+
name: hist-normal-btc
248
+
---
214
249
r = np.random.standard_t(df=5, size=1000)
215
250
216
251
fig, ax = plt.subplots()
@@ -274,10 +309,6 @@ like
274
309
We return to these points [below](https://intro.quantecon.org/heavy_tails.html#why-do-heavy-tails-matter).
275
310
276
311
277
-
278
-
279
-
280
-
281
312
## Visual comparisons
282
313
In this section, we will introduce important concepts such as the Pareto distribution, Counter CDFs, and Power laws, which aid in recognizing heavy-tailed distributions.
283
314
@@ -300,6 +331,12 @@ distribution](https://en.wikipedia.org/wiki/Cauchy_distribution), which is
300
331
heavy-tailed.
301
332
302
333
```{code-cell} ipython3
334
+
---
335
+
mystnb:
336
+
figure:
337
+
caption: Histogram of Cauchy distribution
338
+
name: hist-cauchy
339
+
---
303
340
n = 120
304
341
np.random.seed(11)
305
342
@@ -353,6 +390,12 @@ The exponential distribution is a light-tailed distribution.
353
390
Here are some draws from the exponential distribution.
354
391
355
392
```{code-cell} ipython3
393
+
---
394
+
mystnb:
395
+
figure:
396
+
caption: Histogram of Exponential distribution
397
+
name: hist-exponential
398
+
---
356
399
n = 120
357
400
np.random.seed(11)
358
401
@@ -394,14 +437,22 @@ exponential random variable.
394
437
395
438
In particular, if $X$ is exponentially distributed with rate parameter $\alpha$, then
396
439
397
-
$$ Y = \bar x \exp(X) $$
440
+
$$
441
+
Y = \bar x \exp(X)
442
+
$$
398
443
399
444
is Pareto-distributed with minimum $\bar x$ and tail index $\alpha$.
400
445
401
446
Here are some draws from the Pareto distribution with tail index $1$ and minimum
402
447
$1$.
403
448
404
449
```{code-cell} ipython3
450
+
---
451
+
mystnb:
452
+
figure:
453
+
caption: Histogram of Pareto distribution
454
+
name: hist-pareto
455
+
---
405
456
n = 120
406
457
np.random.seed(11)
407
458
@@ -425,21 +476,27 @@ light and heavy tails is to look at the
425
476
426
477
For a random variable $X$ with CDF $F$, the CCDF is the function
427
478
428
-
$$ G(x) := 1 - F(x) = \mathbb P\{X > x\} $$
479
+
$$
480
+
G(x) := 1 - F(x) = \mathbb P\{X > x\}
481
+
$$
429
482
430
483
(Some authors call $G$ the "survival" function.)
431
484
432
485
The CCDF shows how fast the upper tail goes to zero as $x \to \infty$.
433
486
434
487
If $X$ is exponentially distributed with rate parameter $\alpha$, then the CCDF is
435
488
436
-
$$ G_E(x) = \exp(- \alpha x) $$
489
+
$$
490
+
G_E(x) = \exp(- \alpha x)
491
+
$$
437
492
438
493
This function goes to zero relatively quickly as $x$ gets large.
439
494
440
495
The standard Pareto distribution, where $\bar x = 1$, has CCDF
441
496
442
-
$$ G_P(x) = x^{- \alpha} $$
497
+
$$
498
+
G_P(x) = x^{- \alpha}
499
+
$$
443
500
444
501
This function goes to zero as $x \to \infty$, but much slower than $G_E$.
445
502
@@ -505,13 +562,21 @@ The sample counterpart of the CCDF function is the **empirical CCDF**.
505
562
506
563
Given a sample $x_1, \ldots, x_n$, the empirical CCDF is given by
@@ -918,8 +1015,6 @@ For example, the heaviness of the tail of the income distribution helps
918
1015
determine {doc}`how much revenue a given tax policy will raise <mle>`.
919
1016
920
1017
921
-
922
-
923
1018
(cltail)=
924
1019
## Classifying tail properties
925
1020
@@ -964,7 +1059,9 @@ For example, every random variable with bounded support is light-tailed. (Why?)
964
1059
965
1060
As another example, if $X$ has the [exponential distribution](https://en.wikipedia.org/wiki/Exponential_distribution), with cdf $F(x) = 1 - \exp(-\lambda x)$ for some $\lambda > 0$, then its moment generating function is
0 commit comments