Skip to content

Commit b18eb7e

Browse files
Fix bad multiplication in uprating (#1260)
* Fix bad multiplication in uprating * Update reform tests
1 parent 31579ac commit b18eb7e

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
fixed:
4+
- Bug in uprating.

policyengine_uk/data/economic_assumptions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def apply_single_year_uprating(
4848
prev_year_value = getattr(previous_year, table_name)[
4949
variable
5050
]
51-
current_year_value = prev_year_value * index_rel_change
51+
current_year_value = prev_year_value * (
52+
1 + index_rel_change
53+
)
5254
getattr(current_year, table_name)[
5355
variable
5456
] = current_year_value
@@ -158,11 +160,6 @@ def uprate_rent(
158160
private_rent_growth = (
159161
aggregate_growth - social_weight * social_rent_growth
160162
) / private_weight
161-
print(
162-
f"Backed out private rent growth: {private_rent_growth:.1%} in {year}"
163-
)
164-
print(f"OBR aggregate rent growth: {aggregate_growth:.1%} in {year}")
165-
print(f"Social rent growth: {social_rent_growth:.1%} in {year}")
166163

167164
current_year.household["rent"] = np.where(
168165
is_private_rented,
@@ -182,3 +179,6 @@ def reset_uprating(
182179
for year in dataset.datasets:
183180
if year != first_year:
184181
dataset.datasets[year] = dataset.datasets[first_year].copy()
182+
dataset.datasets[year].time_period = str(year)
183+
184+
return dataset

policyengine_uk/tests/microsimulation/reforms_config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
reforms:
22
- name: Raise basic rate by 1pp
3-
expected_impact: 7.5
3+
expected_impact: 7.6
44
parameters:
55
gov.hmrc.income_tax.rates.uk[0].rate: 0.21
66
- name: Raise higher rate by 1pp
@@ -16,18 +16,18 @@ reforms:
1616
parameters:
1717
gov.hmrc.child_benefit.amount.additional: 25
1818
- name: Reduce Universal Credit taper rate to 20%
19-
expected_impact: -36.4
19+
expected_impact: -36.6
2020
parameters:
2121
gov.dwp.universal_credit.means_test.reduction_rate: 0.2
2222
- name: Raise Class 1 main employee NICs rate to 10%
2323
expected_impact: 12.3
2424
parameters:
2525
gov.hmrc.national_insurance.class_1.rates.employee.main: 0.1
2626
- name: Raise VAT standard rate by 2pp
27-
expected_impact: 18.9
27+
expected_impact: 18.8
2828
parameters:
2929
gov.hmrc.vat.standard_rate: 0.22
3030
- name: Raise additional rate by 3pp
31-
expected_impact: 5.3
31+
expected_impact: 5.4
3232
parameters:
3333
gov.hmrc.income_tax.rates.uk[2].rate: 0.48

0 commit comments

Comments
 (0)