inequality.schutz.Schutz#

class inequality.schutz.Schutz(df, column_name)[source]#

The Schutz class calculates measures of inequality in an income distribution.

It calculates the Schutz distance, which is the maximum distance between the line of perfect equality and the Lorenz curve. Additionally, it computes the intersection point with the line of perfect equality where the Schutz distance occurs and the original Schutz coefficient. See [Sch51].

Parameters:
dfpd.DataFrame

The input DataFrame containing the data.

column_namestr

The name of the column for which the Schutz coefficient is to be calculated.

Attributes:
dfpd.DataFrame

The input DataFrame containing the data.

column_namestr

The name of the column for which the Schutz coefficient is to be calculated.

df_processedpd.DataFrame

The processed DataFrame with additional columns.

distancefloat

The maximum distance between the line of perfect equality and the Lorenz curve.

intersection_pointfloat

The x and y coordinate of the intersection point where the Schutz distance occurs.

coefficientfloat

The original Schutz coefficient.

Examples

>>> import pandas as pd
>>> gdf = pd.DataFrame({
...     'NAME': ['A', 'B', 'C', 'D', 'E'],
...     'Y': [1000, 2000, 1500, 3000, 2500]
... })
>>> schutz_obj = Schutz(gdf, 'Y')
>>> print("Schutz Distance:", round(float(schutz_obj.distance),2))
Schutz Distance: 0.15
>>> print("Intersection Point:", round(schutz_obj.intersection_point, 1))
Intersection Point: 0.6
>>> print("Schutz Coefficient:", round(schutz_obj.coefficient, 1))
Schutz Coefficient: 7.5
__init__(df, column_name)[source]#

Initialize the Schutz object, calculate the Schutz distance, the intersection point with the line of perfect equality, and the original Schutz coefficient.

Parameters:
df: pd.DataFrame

The input DataFrame containing the data.

column_name: str

The name of the column for which the Schutz coefficient is to be calculated.

Methods

__init__(df, column_name)

Initialize the Schutz object, calculate the Schutz distance, the intersection point with the line of perfect equality, and the original Schutz coefficient.

calculate_intersection_point()

Calculate the intersection point of the line of perfect equality and the Lorenz curve.

calculate_schutz_coefficient()

Calculate the original Schutz coefficient.

calculate_schutz_distance()

Calculate the Schutz distance, which is the maximum distance between the line of perfect equality and the Lorenz curve.

plot([xlabel, ylabel, grid, title])

Plot the Lorenz curve, the line of perfect equality, and the Schutz line.

calculate_intersection_point()[source]#

Calculate the intersection point of the line of perfect equality and the Lorenz curve.

Returns:
float

The x and y coordinate of the intersection point where the Schutz distance occurs.

calculate_schutz_coefficient()[source]#

Calculate the original Schutz coefficient.

Returns:
float

The Schutz coefficient.

calculate_schutz_distance()[source]#

Calculate the Schutz distance, which is the maximum distance between the line of perfect equality and the Lorenz curve.

Returns:
float

The maximum distance indicating the level of inequality.

plot(xlabel='Cumulative Share of the Population', ylabel='Cumulative Share of Income', grid=True, title=None)[source]#

Plot the Lorenz curve, the line of perfect equality, and the Schutz line.

The plot shows the Lorenz curve, a 45-degree line representing perfect equality, and the Schutz line dropping vertically from the intersection point on the line of perfect equality to the Lorenz curve.