Named after Italian statistician Corrado Gini, the Gini coefficient is a way to measure the income distribution of a population.
The value for the Gini coefficient ranges from 0 to 1 where higher values represent greater income inequality and where:
- 0 represents perfect income equality (everyone has the same income)
- 1 represents perfect income inequality (one individual has all the income)
You can find a list of Gini coefficients by country here.
The following step-by-step example shows how to calculate a Gini coefficient in Excel.
Step 1: Enter the Data
First, we must enter values for two columns: the cumulative population % and cumulative income % of individuals in a certain country:

Here’s how to interpret the values:
- The bottom 20% of individuals in this country account for 10% of the total income.
- The bottom 50% of individuals in this country account for 31% of the total income.
- The bottom 60% of individuals in this country account for 40% of the total income.
- 100% of individuals in this country account for 100% of the total income.
Step 2: Calculate Areas Under Lorenz Curve
Next, we need to calculate the individual areas under the Lorenz curve, which is a curve we use to visualize the distribution of income in a country.
In our example, we’ll type the following formula in cell C3:
=(A3-A2)*(B3+B2)*0.5
We’ll then copy and paste this formula down to every remaining cell in column C:

Step 3: Calculate Gini Coefficient
Lastly, we can type the following formula into cell D2 to calculate the Gini coefficient for this population:
=1-2*SUM(C3:C6)
The following screenshot shows how to use this formula in practice:

The Gini coefficient for this population turns out to be 0.226.
This is an extremely simple example of how to calculate a Gini coefficient but you can use these exact same formulas to calculate a Gini coefficient for a much larger dataset.
Hi Zach
I am trying to apply the Gini coefficient on a set of data from the Formula 1 driver championship 1950-2024. Data are the average points per race earned by drivers for each season. Purpose is to measure level of competitiveness in each season.
How do I proceed?
Hi there,
I’m happy to help you apply the Gini coefficient to your Formula 1 dataset to measure the level of competitiveness in each season from 1950 to 2024. The Gini coefficient is a statistical measure of distribution often used to gauge inequality. In your context, it will quantify how evenly the average points per race are distributed among drivers in each season—a higher Gini coefficient indicates more inequality (less competitiveness), while a lower coefficient suggests more equality (greater competitiveness).
Step-by-Step Guide to Calculating the Gini Coefficient
1. Prepare Your Data
Data Structure: For each season, you should have a list of drivers and their corresponding average points per race.
Driver Name Average Points per Race
Driver A 10.5
Driver B 8.2
Driver C 0
… …
2. Sort the Data
Ascending Order: Sort the average points per race in ascending order for each season.
3. Calculate the Gini Coefficient
There are multiple formulas to calculate the Gini coefficient for discrete data. Here’s a commonly used method suitable for your dataset:
Gini Coefficient Formula:
𝐺
=
∑
𝑖
=
1
𝑛
∑
𝑗
=
1
𝑛
∣
𝑥
𝑖
−
𝑥
𝑗
∣
2
𝑛
2
𝜇
G=
2n
2
μ
∑
i=1
n
∑
j=1
n
∣x
i
−x
j
∣
Where:
𝐺
G = Gini coefficient
𝑛
n = Number of drivers
𝑥
𝑖
,
𝑥
𝑗
x
i
,x
j
= Average points per race for drivers
𝑖
i and
𝑗
j
𝜇
μ = Mean of the average points per race
Step-by-Step Calculation:
Compute the Mean (
𝜇
μ)
𝜇
=
∑
𝑖
=
1
𝑛
𝑥
𝑖
𝑛
μ=
n
∑
i=1
n
x
i
Calculate the Absolute Differences
For all pairs
(
𝑥
𝑖
,
𝑥
𝑗
)
(x
i
,x
j
), compute
∣
𝑥
𝑖
−
𝑥
𝑗
∣
∣x
i
−x
j
∣.
Sum all these absolute differences.
Apply the Gini Formula
𝐺
=
Total Absolute Differences
2
𝑛
2
𝜇
G=
2n
2
μ
Total Absolute Differences
4. Implementing the Calculation
Option A: Using Excel
Step 1: Enter your sorted data in column A.
Step 2: Calculate the mean (
𝜇
μ) using:
excel
Copy code
=AVERAGE(A2:A{n+1})
Step 3: Create a matrix of absolute differences.
Suppose your data is in cells A2 to A{n+1}.
In cell B2, use:
excel
Copy code
=ABS($A2 – A2)
Drag this formula across and down to create an
𝑛
×
𝑛
n×n matrix.
Step 4: Sum all the absolute differences.
excel
Copy code
=SUM(B2:{LastCell})
Step 5: Calculate the Gini coefficient.
excel
Copy code
= (Total Absolute Differences) / (2 * n^2 * Mean)
Option B: Using Python
Here’s a Python function to calculate the Gini coefficient:
python
Copy code
def gini_coefficient(data):
data = sorted(data) # Sort data in ascending order
n = len(data)
mean = sum(data) / n
total_diff = sum(abs(x_i – x_j) for x_i in data for x_j in data)
gini = total_diff / (2 * n**2 * mean)
return gini
Example Usage:
python
Copy code
average_points = [0, 2.5, 5.0, 7.5, 10.0] # Replace with your data
gini = gini_coefficient(average_points)
print(f”Gini Coefficient: {gini}”)
Interpreting the Results
Gini Coefficient Range: The value ranges from 0 to 1.
0: Perfect equality—all drivers have the same average points per race.
1: Maximum inequality—one driver has all the points, and others have none.
Competitiveness Analysis:
High Gini Coefficient: Indicates a season dominated by a few drivers, suggesting low competitiveness.
Low Gini Coefficient: Points are more evenly distributed among drivers, indicating higher competitiveness.
Additional Considerations
Handling Zero or Missing Values
Zero Points: Drivers with zero average points per race should be included, as they impact the overall competitiveness.
Missing Data: Ensure that your dataset is complete for each season. Missing data can skew the Gini coefficient.
Adjusting for Number of Races
Consistency: Since the number of races per season can vary, using average points per race is appropriate.
Normalization: You’ve already normalized the data by calculating averages, which makes comparisons between seasons valid.
Visualizing Competitiveness Over Time
Plotting Gini Coefficient:
Create a line chart with seasons on the x-axis and the Gini coefficient on the y-axis.
This visualization can help identify trends in competitiveness over the years.
Comparative Analysis:
Identify periods with significant changes in competitiveness.
Correlate these changes with historical events, rule changes, or other factors in Formula 1.
Example Calculation
Let’s walk through a simple example with hypothetical data for one season.
Data:
Driver Average Points per Race
A 10
B 8
C 5
D 2
E 0
Steps:
Sort Data:
[
0
,
2
,
5
,
8
,
10
]
[0,2,5,8,10]
Calculate Mean (
𝜇
μ):
𝜇
=
0
+
2
+
5
+
8
+
10
5
=
5
μ=
5
0+2+5+8+10
=5
Calculate Total Absolute Differences:
Compute all
∣
𝑥
𝑖
−
𝑥
𝑗
∣
∣x
i
−x
j
∣:
∣
0
−
0
∣
+
∣
0
−
2
∣
+
∣
0
−
5
∣
+
∣
0
−
8
∣
+
∣
0
−
10
∣
+
∣
2
−
0
∣
+
∣
2
−
2
∣
+
∣
2
−
5
∣
+
∣
2
−
8
∣
+
∣
2
−
10
∣
+
∣
5
−
0
∣
+
∣
5
−
2
∣
+
∣
5
−
5
∣
+
∣
5
−
8
∣
+
∣
5
−
10
∣
+
∣
8
−
0
∣
+
∣
8
−
2
∣
+
∣
8
−
5
∣
+
∣
8
−
8
∣
+
∣
8
−
10
∣
+
∣
10
−
0
∣
+
∣
10
−
2
∣
+
∣
10
−
5
∣
+
∣
10
−
8
∣
+
∣
10
−
10
∣
+
+
+
+
∣0−0∣+∣0−2∣+∣0−5∣+∣0−8∣+∣0−10∣
∣2−0∣+∣2−2∣+∣2−5∣+∣2−8∣+∣2−10∣
∣5−0∣+∣5−2∣+∣5−5∣+∣5−8∣+∣5−10∣
∣8−0∣+∣8−2∣+∣8−5∣+∣8−8∣+∣8−10∣
∣10−0∣+∣10−2∣+∣10−5∣+∣10−8∣+∣10−10∣
Sum of absolute differences:
Total
=
0
+
2
+
5
+
8
+
10
+
2
+
0
+
3
+
6
+
8
+
5
+
3
+
0
+
3
+
5
+
8
+
6
+
3
+
0
+
2
+
10
+
8
+
5
+
2
+
0
=
88
Total=0+2+5+8+10+2+0+3+6+8+5+3+0+3+5+8+6+3+0+2+10+8+5+2+0=88
Apply Gini Formula:
𝐺
=
88
2
×
5
2
×
5
=
88
2
×
25
×
5
=
88
250
=
0.352
G=
2×5
2
×5
88
=
2×25×5
88
=
250
88
=0.352
Interpretation:
The Gini coefficient for this season is 0.352, suggesting a moderate level of inequality in the distribution of average points per race.
Conclusion
By following these steps for each season in your dataset, you can calculate the Gini coefficient to measure the competitiveness of Formula 1 championships over the years. This analysis can provide valuable insights into how competitiveness has evolved and identify factors that may have influenced changes.
If you need further assistance with the calculations or have questions about interpreting the results, feel free to ask!