Skip to content

Commit 50f75e3

Browse files
committed
review in jupyter-lab
1 parent dd87e38 commit 50f75e3

File tree

2 files changed

+33
-38
lines changed

2 files changed

+33
-38
lines changed
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
year,n_wealth,t_income,l_income
2-
1950,0.825733203436636,0.44248654139458754,0.5342948198773422
3-
1953,0.8059487586599333,0.42645440609359464,0.5158978980963698
4-
1956,0.8121790488050616,0.4442694287339925,0.5349293526208134
5-
1959,0.7952068741637915,0.43749348077061606,0.5213985948309418
6-
1962,0.8086945076579374,0.4435843103853642,0.5345127915054336
7-
1965,0.7904149225687952,0.43763715466663355,0.7487860020887757
8-
1968,0.7982885066993517,0.42086207944388965,0.5242396427381534
9-
1971,0.7911574835420259,0.42333442460902565,0.5576454812313468
10-
1977,0.7571418922185198,0.46187678800902515,0.5704448110072063
11-
1983,0.7494335400643009,0.43934561846446973,0.5662220844385935
12-
1989,0.7715705301674317,0.5115249581654214,0.6013995687471423
13-
1992,0.7508126614055307,0.47406506720767516,0.5983592657979556
14-
1995,0.7569492388110264,0.48965523558400864,0.5969779516716902
15-
1998,0.7603291991801189,0.49117441585169025,0.5774462841723348
16-
2001,0.7816118750507017,0.5239092994681133,0.604273964496734
17-
2004,0.7700355469522374,0.48843503839032487,0.5981432201792718
18-
2007,0.7821413776486984,0.5197156312086194,0.6263452195753234
19-
2010,0.8250825295193427,0.5195972120145639,0.6453653328291896
20-
2013,0.8227698931835266,0.5314001749843371,0.6498682917772642
21-
2016,0.8342975903562223,0.5541400068900839,0.6706846793375303
2+
1950,0.8257332034366344,0.44248654139458693,0.5342948198773417
3+
1953,0.8059487586599325,0.42645440609359514,0.5158978980963705
4+
1956,0.8121790488050629,0.4442694287339931,0.5349293526208135
5+
1959,0.7952068741637919,0.4374934807706156,0.5213985948309419
6+
1962,0.8086945076579375,0.4435843103853644,0.5345127915054356
7+
1965,0.7904149225687939,0.43763715466663433,0.7487860020887759
8+
1968,0.7982885066993506,0.42086207944389026,0.5242396427381537
9+
1971,0.7911574835420256,0.42333442460902515,0.5576454812313486
10+
1977,0.7571418922185218,0.46187678800902543,0.5704448110072071
11+
1983,0.749433540064304,0.43934561846446973,0.5662220844385909
12+
1989,0.7715705301674298,0.51152495816542,0.6013995687471444
13+
1992,0.7508126614055317,0.4740650672076807,0.5983592657979544
14+
1995,0.7569492388110282,0.48965523558400603,0.596977951671693
15+
1998,0.7603291991801175,0.4911744158516888,0.5774462841723299
16+
2001,0.7816118750507037,0.5239092994681126,0.6042739644967319
17+
2004,0.7700355469522371,0.48843503839032426,0.5981432201792735
18+
2007,0.782141377648699,0.5197156312086187,0.6263452195753223
19+
2010,0.8250825295193419,0.5195972120145633,0.6453653328291933
20+
2013,0.8227698931835327,0.5314001749843346,0.6498682917772663
21+
2016,0.8342975903562247,0.5541400068900854,0.670684679337527

lectures/inequality.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ ax.plot(f_vals_nw[-1], l_vals_nw[-1], label=f'net wealth')
303303
ax.plot(f_vals_ti[-1], l_vals_ti[-1], label=f'total income')
304304
ax.plot(f_vals_li[-1], l_vals_li[-1], label=f'labor income')
305305
ax.plot(f_vals_nw[-1], f_vals_nw[-1], label=f'equality')
306+
ax.set_xlabel("household percentile")
307+
ax.set_ylabel("income/wealth percentile")
306308
ax.legend()
307309
plt.show()
308310
```
@@ -356,23 +358,18 @@ mystnb:
356358
name: lorenz_gini
357359
---
358360
fig, ax = plt.subplots()
359-
360361
f_vals, l_vals = lorenz_curve(sample)
361362
ax.plot(f_vals, l_vals, label=f'lognormal sample', lw=2)
362363
ax.plot(f_vals, f_vals, label='equality', lw=2)
363-
364-
ax.legend()
365-
366364
ax.vlines([0.8], [0.0], [0.43], alpha=0.5, colors='k', ls='--')
367365
ax.hlines([0.43], [0], [0.8], alpha=0.5, colors='k', ls='--')
368-
369366
ax.fill_between(f_vals, l_vals, f_vals, alpha=0.06)
370-
371367
ax.set_ylim((0, 1))
372368
ax.set_xlim((0, 1))
373-
374369
ax.text(0.04, 0.5, r'$G = 2 \times$ shaded area')
375-
370+
ax.set_xlabel("household percentile")
371+
ax.set_ylabel("income/wealth percentile")
372+
ax.legend()
376373
plt.show()
377374
```
378375
@@ -391,21 +388,17 @@ mystnb:
391388
name: lorenz_gini2
392389
---
393390
fig, ax = plt.subplots()
394-
395391
f_vals, l_vals = lorenz_curve(sample)
396-
397392
ax.plot(f_vals, l_vals, label='lognormal sample', lw=2)
398393
ax.plot(f_vals, f_vals, label='equality', lw=2)
399-
400394
ax.fill_between(f_vals, l_vals, f_vals, alpha=0.06)
401395
ax.fill_between(f_vals, l_vals, np.zeros_like(f_vals), alpha=0.06)
402-
403396
ax.set_ylim((0, 1))
404397
ax.set_xlim((0, 1))
405-
406398
ax.text(0.55, 0.4, 'A')
407399
ax.text(0.75, 0.15, 'B')
408-
400+
ax.set_xlabel("household percentile")
401+
ax.set_ylabel("income/wealth percentile")
409402
ax.legend()
410403
plt.show()
411404
```
@@ -711,7 +704,9 @@ We will smooth our data and take an average of the data either side of it for th
711704
712705
```{code-cell} ipython3
713706
ginis["l_income"][1965] = (ginis["l_income"][1962] + ginis["l_income"][1968]) / 2
714-
ginis["l_income"].plot()
707+
ax = ginis["l_income"].plot()
708+
ax.set_ylabel("Gini coefficient")
709+
plt.show()
715710
```
716711
717712
Now we can focus on US net wealth
@@ -728,7 +723,7 @@ mystnb:
728723
fig, ax = plt.subplots()
729724
ax.plot(years, ginis["n_wealth"], marker='o')
730725
ax.set_xlabel("year")
731-
ax.set_ylabel("gini coefficient")
726+
ax.set_ylabel("Gini coefficient")
732727
plt.show()
733728
```
734729
@@ -747,7 +742,7 @@ fig, ax = plt.subplots()
747742
ax.plot(years, ginis["l_income"], marker='o', label="labor income")
748743
ax.plot(years, ginis["t_income"], marker='o', label="total income")
749744
ax.set_xlabel("year")
750-
ax.set_ylabel("gini coefficient")
745+
ax.set_ylabel("Gini coefficient")
751746
ax.legend()
752747
plt.show()
753748
```
@@ -759,7 +754,7 @@ fig, ax = plt.subplots()
759754
ax.plot(years, ginis["n_wealth"], marker='o', label="net wealth")
760755
ax.plot(years, ginis["l_income"], marker='o', label="labour income")
761756
ax.set_xlabel("year")
762-
ax.set_ylabel("gini coefficient")
757+
ax.set_ylabel("Gini coefficient")
763758
ax.legend()
764759
plt.show()
765760
```

0 commit comments

Comments
 (0)