Skip to content

Commit e7fa274

Browse files
authored
Merge branch 'main' into DistributionalImpactW
2 parents 6de517e + c240cbf commit e7fa274

File tree

14 files changed

+448
-1
lines changed

14 files changed

+448
-1
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Income Distribution by Average
2+
3+
## Overview
4+
5+
The income distribution by average metrics provide insights into how a policy reform affects the average income across different income deciles. These metrics are part of the `EconomicImpact` class and measure the average change in household net income due to the reform.
6+
7+
## Available Metrics
8+
9+
1. `distributional/by_income/average`: Calculates the average change in household net income by income decile.
10+
11+
## Metric Structure
12+
13+
Each metric returns a dictionary with the following keys:
14+
- `average`: A dictionary where the key is the income decile, and the value is the average change in income for that decile.
15+
16+
The values represent the change in income due to the policy reform, rounded to several decimal places.
17+
18+
## Example Usage
19+
20+
```python
21+
from policyengine import EconomicImpact
22+
23+
# Initialize the EconomicImpact class with a reform
24+
impact = EconomicImpact(reform={
25+
"gov.hmrc.income_tax.rates.uk[0].rate": {
26+
"2024-01-01.2100-12-31": 0.55
27+
}}, country="uk")
28+
29+
# Calculate average income change by income decile
30+
average_income_change = impact.calculate("distributional/by_income/average")
31+
32+
# Print the result
33+
print(f"Average income change: {average_income_change}")
34+
```
35+
36+
## Output
37+
38+
```
39+
Average income change: {'average': {1: -1542.53, 2: -1982.53, 3: -4556.84, 4: -5370.20, 5: -7216.05, 6: -7591.30, 7: -9211.03, 8: -9648.62, 9: -11506.89, 10: -14378.30, 11: -13195.00}}
40+
```
41+
42+
## Interpretation
43+
44+
In this example:
45+
46+
- The average income change is negative across all deciles, indicating a reduction in household net income due to the policy reform.
47+
- The change is most significant in the higher deciles, with the highest decrease observed in the top decile (11), at -13,195.00.
48+
- The impact is progressively less severe in lower deciles, with the smallest decrease observed in the lowest decile (1), at -1,542.53.
49+
50+
---
51+
52+
Let me know if you need any further adjustments!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# By income
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Income Decile by Relative Change
2+
3+
## Overview
4+
5+
The income decile by relative change metrics provide insights into how a policy reform affects household net income across different income deciles in relative terms. These metrics are part of the `EconomicImpact` class and measure the relative change in income due to the reform, expressed as a percentage of the baseline income.
6+
7+
## Available Metrics
8+
9+
1. `distributional/by_income/relative`: Calculates the relative change in household net income by income decile.
10+
11+
## Metric Structure
12+
13+
Each metric returns a dictionary with the following keys:
14+
- `relative`: A dictionary where the key is the income decile, and the value is the relative change in income for that decile. The relative change is expressed as a percentage of the baseline income.
15+
16+
The values are rounded to several decimal places.
17+
18+
## Example Usage
19+
20+
```python
21+
from policyengine import EconomicImpact
22+
23+
# Initialize the EconomicImpact class with a reform
24+
impact = EconomicImpact(reform={
25+
"gov.hmrc.income_tax.rates.uk[0].rate": {
26+
"2024-01-01.2100-12-31": 0.55
27+
}}, country="uk")
28+
29+
# Calculate relative income change by income decile
30+
relative_income_change = impact.calculate("distributional/by_income/relative")
31+
32+
# Print the result
33+
print(f"Relative income change: {relative_income_change}")
34+
```
35+
36+
## Output
37+
38+
```
39+
Relative income change: {'relative': {1: -0.0704, 2: -0.0809, 3: -0.1465, 4: -0.1559, 5: -0.1784, 6: -0.1823, 7: -0.1986, 8: -0.1832, 9: -0.1960, 10: -0.1392, 11: -0.0281}}
40+
```
41+
42+
## Interpretation
43+
44+
In this example:
45+
46+
- The relative income change is negative across all deciles, indicating a reduction in household net income as a percentage of the baseline.
47+
- The highest relative decrease is observed in the 7th decile, with a reduction of approximately 19.86%.
48+
- The smallest relative decrease is in the 11th decile, at about 2.81%.
49+
- The relative changes vary by decile, reflecting the impact of the policy reform on different income groups.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Average
2+
3+
## Overview
4+
5+
The wealth distribution by average metrics provide insights into how a policy reform affects the average wealth across different wealth deciles. These metrics are part of the `EconomicImpact` class and measure the average change in household net wealth due to the reform.
6+
7+
## Available Metrics
8+
9+
1. `distributional/by_wealth/average`: Calculates the average change in household net wealth by wealth decile.
10+
11+
## Metric Structure
12+
13+
Each metric returns a dictionary with the following keys:
14+
- `average`: A dictionary where the key is the wealth decile, and the value is the average change in wealth for that decile.
15+
16+
The values represent the change in wealth due to the policy reform, rounded to several decimal places.
17+
18+
## Example Usage
19+
20+
```python
21+
from policyengine import EconomicImpact
22+
23+
# Initialize the EconomicImpact class with a reform
24+
impact = EconomicImpact(reform={
25+
"gov.hmrc.income_tax.rates.uk[0].rate": {
26+
"2024-01-01.2100-12-31": 0.55
27+
}}, country="uk")
28+
29+
# Calculate average wealth change by wealth decile
30+
average_wealth_change = impact.calculate("distributional/by_wealth/average")
31+
32+
# Print the result
33+
print(f"Average wealth change: {average_wealth_change}")
34+
```
35+
36+
## Output
37+
38+
```
39+
Average wealth change: {'average': {1: -1542.53, 2: -1982.53, 3: -4556.84, 4: -5370.20, 5: -7216.05, 6: -7591.30, 7: -9211.03, 8: -9648.62, 9: -11506.89, 10: -14378.30, 11: -13195.00}}
40+
```
41+
42+
## Interpretation
43+
44+
In this example:
45+
46+
- The average wealth change is negative across all deciles, indicating a reduction in household net wealth due to the policy reform.
47+
- The impact is most severe in the highest deciles, with the highest decrease observed in the top decile (11), at -13,195.00.
48+
- The decrease in wealth is progressively less severe in lower deciles, with the smallest decrease observed in the lowest decile (1), at -1,542.53.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# by wealth
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Relative
2+
3+
## Overview
4+
5+
The wealth distribution by relative change metrics provide insights into how a policy reform affects the relative change in household net income across different wealth deciles. These metrics are part of the `EconomicImpact` class and measure the proportional change in income due to the reform.
6+
7+
## Available Metrics
8+
9+
1. `distributional/by_wealth/relative`: Calculates the relative change in household net income by wealth decile.
10+
11+
## Metric Structure
12+
13+
Each metric returns a dictionary with the following keys:
14+
- `relative`: A dictionary where the key is the wealth decile, and the value is the relative change in income for that decile.
15+
16+
The relative change is calculated as the ratio of the change in income to the baseline income, providing a measure of how income changes proportionally within each decile.
17+
18+
## Example Usage
19+
20+
```python
21+
from policyengine import EconomicImpact
22+
23+
# Initialize the EconomicImpact class with a reform
24+
impact = EconomicImpact(reform={
25+
"gov.hmrc.income_tax.rates.uk[0].rate": {
26+
"2024-01-01.2100-12-31": 0.55
27+
}}, country="uk")
28+
29+
# Calculate relative income change by wealth decile
30+
relative_income_change = impact.calculate("distributional/by_wealth/relative")
31+
32+
# Print the result
33+
print(f"Relative income change: {relative_income_change}")
34+
```
35+
36+
## Output
37+
38+
```
39+
Relative income change: {'relative': {1: -0.0704, 2: -0.0809, 3: -0.1465, 4: -0.1559, 5: -0.1784, 6: -0.1823, 7: -0.1986, 8: -0.1832, 9: -0.1960, 10: -0.1392, 11: -0.0281}}
40+
```
41+
42+
## Interpretation
43+
44+
In this example:
45+
46+
- The relative income change is negative across all wealth deciles, indicating a proportional decrease in household net income due to the policy reform.
47+
- The relative change is highest in the higher deciles, with the most significant decrease observed in the top decile (11), at -0.0281 (2.81% decrease).
48+
- The impact is also noticeable in the lower deciles, with the smallest relative decrease observed in the lowest decile (1), at -0.0704 (7.04% decrease).

docs/Distributional/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Distributional

docs/Inequality/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Inequality

docs/Inequality/inequality.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Inequality Impact
2+
3+
## Overview
4+
5+
The inequality impact metrics provide insights into how a policy reform affects income distribution. These metrics are part of the `EconomicImpact` class and include measures of income inequality and concentration of income among the top earners.
6+
7+
## Available Metrics
8+
9+
1. **`inequality/gini`**: Calculates the Gini coefficient, which measures income inequality.
10+
2. **`inequality/top_1_pct_share`**: Calculates the income share of the top 1% of earners.
11+
3. **`inequality/top_10_pct_share`**: Calculates the income share of the top 10% of earners.
12+
13+
## Metric Structure
14+
15+
Each metric returns a dictionary with the following keys:
16+
- **`baseline`**: The metric value before the reform.
17+
- **`reform`**: The metric value after the reform.
18+
- **`change`**: The absolute change in the metric value due to the reform.
19+
- **`change_percentage`**: The percentage change in the metric value due to the reform (only for Gini coefficient and top 1% share).
20+
21+
All values are rounded to 2 decimal places for baseline, reform, change, and change percentage.
22+
23+
## Example Usage
24+
25+
```python
26+
from policyengine import EconomicImpact
27+
28+
# Initialize the EconomicImpact class with a reform
29+
impact = EconomicImpact(
30+
reform={"gov.hmrc.income_tax.rates.uk[0].rate": {"2024-01-01": 0.25}},
31+
country="uk"
32+
)
33+
34+
# Calculate Gini coefficient impact
35+
gini_impact = impact.calculate("inequality/gini")
36+
37+
# Calculate top 1% income share impact
38+
top_1_pct_share = impact.calculate("inequality/top_1_pct_share")
39+
40+
# Calculate top 10% income share impact
41+
top_10_pct_share = impact.calculate("inequality/top_10_pct_share")
42+
43+
# Print the results
44+
print(f"Gini coefficient impact: {gini_impact}")
45+
print(f"Top 1% income share impact: {top_1_pct_share}")
46+
print(f"Top 10% income share impact: {top_10_pct_share}")
47+
```
48+
49+
## Output
50+
51+
```
52+
Gini coefficient impact: {'baseline': 0.43, 'reform': 0.43, 'change': -0.00, 'change_percentage': -0.39}
53+
Top 1% income share impact: {'baseline': 0.09, 'reform': 0.09, 'change': 0.00, 'change_percentage': 1.96}
54+
Top 10% income share impact: {'baseline': 0.31, 'reform': 0.31, 'change': 0.00, 'change_percentage': 0.64}
55+
```
56+
57+
## Interpretation
58+
59+
In this example:
60+
61+
- The Gini coefficient decreases slightly from 0.43 to 0.43, indicating a small reduction in income inequality.
62+
- The income share of the top 1% increases from 9.12% to 9.30%, reflecting a slight rise in concentration among the highest earners.
63+
- The income share of the top 10% increases from 31.02% to 31.21%, showing a minor rise in the share of income held by the top 10% of earners.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# by Income Decile
2+
3+
## Overview
4+
5+
The winners and losers by income decile metrics provide insights into how a policy reform affects income changes across different income deciles. These metrics help to understand the distribution of income gains and losses among various income groups. The analysis is categorized based on the percentage change in income and provides a breakdown for each decile.
6+
7+
## Available Metrics
8+
9+
1. `winners_and_losers/by_income_decile`: Evaluates the income changes across income deciles and categorizes the population based on the magnitude of income gain or loss.
10+
11+
## Metric Structure
12+
13+
Each metric returns a dictionary with the following keys:
14+
- `result`: Contains two sub-dictionaries:
15+
- `deciles`: Breakdown of the population within each decile into categories based on income change.
16+
- `all`: Summary statistics showing the average percentage of the population in each category across all deciles.
17+
18+
### Income Change Categories
19+
20+
The categories used for income change are:
21+
- **Lose more than 5%**: Percentage of the population experiencing an income loss greater than 5%.
22+
- **Lose less than 5%**: Percentage of the population experiencing an income loss less than 5%.
23+
- **No change**: Percentage of the population experiencing no change in income.
24+
- **Gain less than 5%**: Percentage of the population experiencing an income gain less than 5%.
25+
- **Gain more than 5%**: Percentage of the population experiencing an income gain greater than 5%.
26+
27+
## Example Usage
28+
29+
```python
30+
from policyengine import EconomicImpact
31+
32+
# Initialize the EconomicImpact class with a reform
33+
impact = EconomicImpact(reform={
34+
"gov.hmrc.income_tax.rates.uk[0].rate": {
35+
"2024-01-01.2100-12-31": 0.55
36+
}}, country="uk")
37+
38+
# Calculate income change metrics by income decile
39+
by_income = impact.calculate("winners_and_losers/by_income_decile")
40+
by_wealth = impact.calculate("winners_and_losers/by_wealth_decile")
41+
42+
# Print the results
43+
print(f"By Income Decile: {by_income}")
44+
print(f"By Wealth Decile: {by_wealth}")
45+
```
46+
47+
## Output
48+
49+
### By Income Decile
50+
51+
```python
52+
{
53+
'result': {
54+
'deciles': {
55+
'Lose more than 5%': [16.8, 21.8, 28.9, 52.2, 72.4, 85.4, 91.9, 93.0, 98.0, 95.4],
56+
'Lose less than 5%': [2.7, 4.8, 5.8, 9.0, 5.2, 0.3, 0.6, 0.1, 0.0, 1.4],
57+
'No change': [80.5, 73.4, 65.3, 38.8, 22.4, 14.3, 7.5, 6.9, 1.9, 3.1],
58+
'Gain less than 5%': [0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
59+
'Gain more than 5%': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
60+
},
61+
'all': {
62+
'Lose more than 5%': 65.6,
63+
'Lose less than 5%': 3.0,
64+
'No change': 31.4,
65+
'Gain less than 5%': 0.0,
66+
'Gain more than 5%': 0.0
67+
}
68+
}
69+
}
70+
```
71+
72+
## Interpretation
73+
74+
In this example:
75+
76+
- For income deciles, the percentage of people losing more than 5% increases from the lower deciles to the higher deciles, with a substantial concentration of losses in the top deciles. The majority of the population experiences no change in income, with very few gaining or losing within small ranges.
77+
- For wealth deciles, a similar pattern is observed, with a significant proportion of the population in higher deciles experiencing losses greater than 5%, while most people in lower deciles experience no change.
78+

0 commit comments

Comments
 (0)