@@ -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.14.4
88kernelspec :
99 display_name : Python 3 (ipykernel)
1010 language : python
@@ -47,7 +47,7 @@ Many economic policies, from taxation to the welfare state, are
4747aimed at addressing inequality.
4848
4949
50- ### Measurment
50+ ### Measurement
5151
5252One problem with these debates is that inequality is often poorly defined.
5353
@@ -67,6 +67,7 @@ We will install the following libraries.
6767
6868``` {code-cell} ipython3
6969:tags: [hide-output]
70+
7071!pip install --upgrade quantecon interpolation
7172```
7273
@@ -81,9 +82,6 @@ import random as rd
8182from interpolation import interp
8283```
8384
84-
85- +++
86-
8785## The Lorenz Curve
8886
8987One popular measure of inequality is the Lorenz curve.
@@ -130,7 +128,7 @@ income, consumption, etc.
130128
131129### Lorenz Curves of Simulated Data
132130
133- Let's look at some examples and try build understanding.
131+ Let's look at some examples and try to build understanding.
134132
135133In the next figure, we generate $n=2000$ draws from a lognormal
136134distribution and treat these draws as our population.
@@ -180,7 +178,6 @@ Next let's look at the real data, focusing on income and wealth in the US in
180178The following code block imports a subset of the dataset `` SCF_plus `` ,
181179which is derived from the [ Survey of Consumer Finances] ( https://en.wikipedia.org/wiki/Survey_of_Consumer_Finances ) (SCF).
182180
183-
184181``` {code-cell} ipython3
185182url = 'https://media.githubusercontent.com/media/QuantEcon/high_dim_data/main/SCF_plus/SCF_plus_mini.csv'
186183df = pd.read_csv(url)
@@ -237,7 +234,6 @@ for var in varlist:
237234f_vals_nw, f_vals_ti, f_vals_li = F_vals
238235l_vals_nw, l_vals_ti, l_vals_li = L_vals
239236```
240- +++
241237
242238Now we plot Lorenz curves for net wealth, total income and labor income in the
243239US in 2016.
@@ -265,12 +261,13 @@ plt.title("Lorenz curves of US data in 2016")
265261plt.show()
266262```
267263
268- All the income and wealth measures are pre-tax.
264+ Here all the income and wealth measures are pre-tax.
265+
266+ Total income is the sum of households' all income sources, including labor income but excluding capital gains.
269267
270268One key finding from this figure is that wealth inequality is significantly
271269more extreme than income inequality.
272270
273-
274271+++
275272
276273## The Gini Coefficient
@@ -343,8 +340,6 @@ plt.title("Shaded lorenz curve of simulated data")
343340plt.show()
344341```
345342
346- +++
347-
348343### Gini Coefficient Dynamics of Simulated Data
349344
350345Let's examine the Gini coefficient in some simulations.
@@ -365,7 +360,6 @@ This implies that the mean the distribution does not change with $\sigma$.
365360(You can check this by looking up the expression for the mean of a lognormal
366361distribution.)
367362
368-
369363``` {code-cell} ipython3
370364k = 5
371365σ_vals = np.linspace(0.2, 2.5, k)
@@ -464,8 +458,9 @@ ginis_nw, ginis_ti, ginis_li = Ginis
464458Let's plot the Gini coefficients for net wealth, labor income and total income.
465459
466460``` {code-cell} ipython3
461+ # use an average to replace an outlier in labor income gini
467462ginis_li_new = ginis_li
468- ginis_li_new[5] = (ginis_li[4] + ginis_li[6]) / 2
463+ ginis_li_new[5] = (ginis_li[4] + ginis_li[6]) / 2
469464```
470465
471466``` {code-cell} ipython3
@@ -484,21 +479,37 @@ ylabel = "gini coefficient"
484479
485480fig, ax = plt.subplots()
486481
482+ ax.plot(years, ginis_nw, marker='o')
483+
484+ ax.set_xlabel(xlabel, fontsize=12)
485+ ax.set_ylabel(ylabel, fontsize=12)
486+
487+
488+ plt.title("Gini coefficients of US net wealth data")
489+ plt.show()
490+ ```
491+
492+ ``` {code-cell} ipython3
493+ xlabel = "year"
494+ ylabel = "gini coefficient"
495+
496+ fig, ax = plt.subplots()
497+
487498ax.plot(years, ginis_li_new, marker='o', label="labor income")
488- ax.plot(years, ginis_nw, marker='o', label="net wealth")
489499ax.plot(years, ginis_ti, marker='o', label="total income")
490500
491501ax.set_xlabel(xlabel, fontsize=12)
492502ax.set_ylabel(ylabel, fontsize=12)
493503
494504ax.legend(fontsize=12)
495- plt.title("Gini coefficients of US data")
505+ plt.title("Gini coefficients of US income data")
496506plt.show()
497507```
498508
499509We see that, by this measure, inequality in wealth and income has risen
500510substantially since 1980.
501511
512+ The wealth time series exhibits a strong U-shape.
502513
503514
504515## Top Shares
@@ -520,11 +531,11 @@ share is defined as
520531
521532$$
522533T(p) = 1 - L (1-p)
523- \approx \frac{\sum_{j\geq i} w_j}{ \sum_{j \leq n} w_j}, \quad i = [ n (1-p)]
534+ \approx \frac{\sum_{j\geq i} w_j}{ \sum_{j \leq n} w_j}, \quad i = \lfloor n (1-p)\rfloor
524535$$(topshares)
525536
526- Here $[\ cdot] $ is the greatest integer function, which rounds-off the real
527- number inside the square bracket down to the integer less than the number.
537+ Here $\lfloor \ cdot \rfloor $ is the floor function, which rounds any real
538+ number inside the square bracket down to the integer less than or equal to that number.
528539
529540+++
530541
0 commit comments