Skip to content

Commit b234722

Browse files
Fix randomness between runs caused by UC reform (#1359)
* Fix random seed * Update tests
1 parent 772d13f commit b234722

3 files changed

Lines changed: 14 additions & 8 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+
- Fixed randomness between runs caused by UC reform.

policyengine_uk/scenarios/uc_reform.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ def add_universal_credit_reform(sim: Microsimulation):
88
sim.tax_benefit_system.parameters.gov.dwp.universal_credit.rebalancing
99
)
1010

11-
uc_seed = np.random.random(len(sim.calculate("benunit_id")))
11+
generator = np.random.default_rng(43)
12+
13+
uc_seed = generator.random(len(sim.calculate("benunit_id")))
1214
p_uc_post_2026_status = {
1315
2025: 0,
1416
2026: 0.11,
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
reforms:
22
- name: Raise basic rate by 1pp
3-
expected_impact: 8.0
3+
expected_impact: 8.1
44
parameters:
55
gov.hmrc.income_tax.rates.uk[0].rate: 0.21
66
- name: Raise higher rate by 1pp
7-
expected_impact: 5.0
7+
expected_impact: 4.9
88
parameters:
99
gov.hmrc.income_tax.rates.uk[1].rate: 0.42
1010
- name: Raise personal allowance by ~800GBP/year
1111
expected_impact: 0.7
1212
parameters:
1313
gov.hmrc.income_tax.allowances.personal_allowance.amount: 13000
1414
- name: Raise child benefit by 25GBP/week per additional child
15-
expected_impact: -1.5
15+
expected_impact: -1.3
1616
parameters:
1717
gov.hmrc.child_benefit.amount.additional: 25
1818
- name: Reduce Universal Credit taper rate to 20%
19-
expected_impact: -36.5
19+
expected_impact: -36.0
2020
parameters:
2121
gov.dwp.universal_credit.means_test.reduction_rate: 0.2
2222
- name: Raise Class 1 main employee NICs rate to 10%
23-
expected_impact: 12.4
23+
expected_impact: 12.5
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: 21.2
27+
expected_impact: 19.1
2828
parameters:
2929
gov.hmrc.vat.standard_rate: 0.22
3030
- name: Raise additional rate by 3pp
31-
expected_impact: 5.4
31+
expected_impact: 4.5
3232
parameters:
3333
gov.hmrc.income_tax.rates.uk[2].rate: 0.48

0 commit comments

Comments
 (0)