<p>The steps you describe make sense except for the last one where you presumably forgot <span class="math-container">$t$</span> subscript. If you did not forgot it but it was deliberate choice it is very strange one since it does not make sense to look at inequality in pooled cross-section in an economy that presumably experienced growth.</p>

CC BY-SA 4.0
2023-08-07T06:35:55.690Z
You're right, I forgot. I distinguished income by period t and found the Gini coefficient for each t separately. The part I'm most unsure about is step1. Is it correct to run step1, which finds the real income at all t first, or after step2, which equalizes the income?
user_A
CC BY-SA 4.0
2023-08-06T09:49:55.210Z
2023-08-06T09:49:55.210Z
1muflon1
<p>I calculated the Gini coefficient through a statistical program (MATLAB), and it came out much larger than I expected. I think I got the Gini coefficient formula right, but I don't know where I went wrong. Here's my calculation process. (I used file 1 with income, household size, and quarters table (1990/1Q-2022/4Q) and file 2 with CPI (2020=100)).</p>
<p><strong>Step1</strong><br>
Calculating real income: dividing each the income by the CPI for corresponding quarter and multiply by 100.</p>
<p><strong>Step2</strong><br>
Equalizing income: dividing the value obtained above by the square root of the number of household members.</p>
<p><strong>Step3</strong><br>
Adding the number of people in the household for all households with the same income.</p>
<p><strong>Step4</strong><br>
Calculating the Gini coefficient according to the following formula</p>
<p><strong>Formula</strong><br></p>
<p><span class="math-container">$$
\frac{\sum_{i=1}^n f(Y_i) \sum_{j=1}^n f(Y_j)\vert Y_i-Y_j\vert}{2\bar Y}
$$</span></p>
<p>where <span class="math-container">$Y_i$</span>is the income of ith household, <span class="math-container">$f(Y_i)$</span> is the frequency of the people of income, and <span class="math-container">$\bar{Y}=\sum_{i=1}^{n}{f\left(Y_i\right)Y_i}$</span></p>
<p>I'm having a hard time keeping up with the reviews. Thank you for your help. I will share the MATLAB code if needed.</p>

<microeconomics><statistics><public-economics>
Am I calculating the Gini coefficient correctly?
user_A
# Am I calculating the Gini coefficient correctly?

(Asked by: username_0 on 2023-08-06)

I calculated the Gini coefficient through a statistical program (MATLAB), and it came out much larger than I expected. I think I got the Gini coefficient formula right, but I don't know where I went wrong. Here's my calculation process. (I used file 1 with income, household size, and quarters table (1990/1Q-2022/4Q) and file 2 with CPI (2020=100)).

**Step1**  
Calculating real income: dividing each the income by the CPI for corresponding quarter and multiply by 100.

**Step2**  
Equalizing income: dividing the value obtained above by the square root of the number of household members.

**Step3**  
Adding the number of people in the household for all households with the same income.

**Step4**  
Calculating the Gini coefficient according to the following formula

**Formula**

$$
\frac{\sum\_{i=1}^n f(Y\_i) \sum\_{j=1}^n f(Y\_j)\vert Y\_i-Y\_j\vert}{2\bar Y}
$$

where $Y\_i$is the income of ith household, $f(Y\_i)$ is the frequency of the people of income, and $\bar{Y}=\sum\_{i=1}^{n}{f\left(Y\_i\right)Y\_i}$

I'm having a hard time keeping up with the reviews. Thank you for your help. I will share the MATLAB code if needed.

**Tags:** microeconomics, statistics, public-economics

---

## 1 answers

### Answer by username_1 on 2023-08-06. Score: 0 | Accepted answer

The steps you describe make sense except for the last one where you presumably forgot $t$ subscript. If you did not forgot it but it was deliberate choice it is very strange one since it does not make sense to look at inequality in pooled cross-section in an economy that presumably experienced growth.

> **Comments:**
> **username_0**: You're right, I forgot. I distinguished income by period t and found the Gini coefficient for each t separately. The part I'm most unsure about is step1. Is it correct to run step1, which finds the real income at all t first, or after step2, which equalizes the income?  

---

