Skip to content

Fix Class 2 and Class 4 NICs against SSCBA 1992 for 2015-16 to 2026-27 - #2058

Draft
MaxGhenis wants to merge 4 commits into
mainfrom
fix-class-2-class-4-ni-parameters
Draft

MaxGhenis wants to merge 4 commits into
mainfrom
fix-class-2-class-4-ni-parameters

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1968
Fixes #1887

Supersedes #1888. Its commit (the Class 2 fix) is the first commit here, unchanged apart from one notebook cell that main had also edited. The second commit is the Class 4 fix that #1888 left for a follow-up.

What was wrong

I read s.11 and s.15 of the Social Security Contributions and Benefits Act 1992 as in force on 6 April of each year from 2015 to 2026, the instrument behind each figure, and regulation 100 of SI 2001/1004. The model samples each tax year at 30 April, so "model year 2023" is 2023-24.

Class 4 (s.15)

Model year Parameter Model Law Source
2023 Lower profits limit £11,908 £12,570 NICs (Increase of Thresholds) Act 2022 s.2(3)-(4)
2023 Additional rate 3.5% 2% s.15(3ZA)(b)
2022 Main rate 10.25% 9.73% Health and Social Care Levy (Repeal) Act 2022 s.2(2)(a)
2022 Additional rate 3.5% 2.73% s.2(2)(b) of that Act
2015 Upper profits limit £42,386 £42,385 SI 2015/588 art 3(b)
  • The 3.5% additional rate matched no statute. The Health and Social Care Levy Act 2021 s.5(2) set 3.25% for 2022-23, and the Repeal Act replaced that with 2.73% for the whole year.
  • Class 4 is charged on the year's profits, so 2022-23 has one rate for the year. The old 2022-11-06: 0.09 entry never took effect, because the year is sampled in April.
  • Three dates were wrong without changing results: the £43,000 upper limit was dated 5 June 2015 (law: 6 April 2016), the 6% main rate 4 April 2024 (law: 6 April 2024), and £12,570 was entered again on 1 January 2024.

Class 2 (s.11), from #1888:

  1. The 2023-24 rate is £3.45 a week (SI 2023/236 reg 3(a)). The model charged £3.15.
  2. In 2022-23 and 2023-24 Class 2 is payable only on profits that exceed the lower profits threshold: £11,908, then £12,570 (SI 2022/1329 reg 2, with effect from 6 April 2022; SI 2023/236 reg 3(b)). Profits from the small profits threshold up to it are treated as paid (s.11(5A)-(5B)). The model charged 52 weeks from the small profits threshold.
  3. The small profits threshold stayed at £6,725 in 2023-24 and 2024-25. The model CPI-uprated it to £7,215.94 and £7,396.34, and projected 2027-28 from 2022 (£7,980) instead of from 2026-27's £7,105 (giving £7,247).
  4. The small profits threshold was £5,965 in 2015-16 and 2016-17 (NICA 2015 Sch 1 para 3). The model had 3,965.
  5. Compulsory Class 2 ended on 6 April 2024 (NICs (Reduction in Rates) Act 2023 s.3), not 1 January 2024. Results don't change.

Regulation 100 (the Class 4 annual maximum). The formula is right. Regulation 100 writes its percentages out, and in every year they equal the Class 4 rates: 9% and 2%; 9.73%, 100/9.73 and 2.73% for 2022-23 (Health and Social Care Levy (Repeal) Act 2022 Sch para 6(2)); 6% and 100/6 from 2024-25 (NICs (Reduction in Rates) Act 2024 s.2(3)). ni_class_4_maximum reads the rate parameters, so it follows each year's text. A comment now records this. The wrong 2023 figures came from the stale parameters, not the formula.

Changes

  • class_4/thresholds/lower_profits_limit.yaml: adds 2023-04-06: 12_570, drops the duplicate 2024-01-01 entry, cites every value.
  • class_4/thresholds/upper_profits_limit.yaml: 2015-16 is 42,385; £43,000 is dated 6 April 2016; cites every value to 2021-22.
  • class_4/rates/main.yaml: 9.73% for 2022-23, 9% from 6 April 2023, 6% dated 6 April 2024.
  • class_4/rates/additional.yaml: 2.73% for 2022-23, 2% from 6 April 2023; drops the 2024-01-01 entry.
  • ni_class_4_maximum: the comment above; no formula change.
  • Class 2 files, as in Fix Class 2 NICs: 2023-24 rate, the 2022-23 lower profits threshold, and the small profits threshold #1888:
    • flat_rate.yaml: £3.45 for 2023-24, zero dated 6 April 2024, citations.
    • small_profits_threshold.yaml: corrected values, and CPI uprating now projects from the latest statutory value.
    • New lower_profits_threshold.yaml and lower_profits_threshold_applies.yaml.
    • ni_class_2: liable on profits above the lower profits threshold when that test applies, else on profits at or above the small profits threshold.
  • Docs: the NI notebook text and saved chart values; model-baseline.md line links.

#1959 (merged) holds the two Class 4 limits through 2030-31. This branch is rebased on it and keeps its 2026-27 to 2030-31 entries unchanged. The NI notebook's saved chart, which #1959 left on the old CPI-uprated thresholds, now shows its values too.

Invariants

For every tax year from 2015-16 to 2026-27, profits ≥ 0 and primary Class 1 ≥ 0:

  1. Parameters. Each Class 2 and Class 4 rate, limit and threshold equals the statutory figure for that year. The test tables are typed from the instruments, not read from the parameter files.
  2. Differential, Class 4. ni_class_4 equals an exact-rational reference: the s.15(3) amount on the full profits, capped by the regulation 100 maximum where primary Class 1 or, before 2024-25, Class 2 is payable.
  3. Differential, Class 2. ni_class_2 is 52 × the weekly rate when s.11(2) makes the earner liable, else 0.
  4. Bounds. 0 ≤ ni_class_4 ≤ the s.15(3) amount; ni_class_2 ∈ {0, 52 × rate}.
  5. Monotonicity. ni_class_2 is non-decreasing in profits.

Tests

  • The four stale 2023 YAML expectations now hold statutory values, each derived in a comment:
    • ni_class_2 over the lower profits threshold: 3.45 × 52 = 179.40.
    • ni_class_4 under the UPL: (30,000 − 12,570) × 9% = 1,568.70.
    • ni_class_4_main over the UPL: 37,700 × 9% = 3,393.
    • ni_class_4_maximum with £100,000 of pay and £100,000 of profits: 1,748.60. Step Four is negative (Case 3, nil); Step Eight is 37,700 × 2% = 754; Step Nine is 49,730 × 2% = 994.60. The old 3,083.22, and the 3,060.05 seen after fixing only the limit, both used the 3.5% rate.
  • New Class 4 YAML cases for 2022-23 (9.73%, 2.73% and the maximum, 2,404.91), 2015-16 and 2016-17. Run against main's parameters, 8 of the 10 Class 4 cases fail; the 2016-17 and 2026-27 cases are regression guards.
  • New test_ni_class_4_statute.py:
    • a statute table for 2015–2026;
    • 20 hand-derived liabilities, with regulation 100 Cases 1, 2 and 3 in each regime (to 2021-22, 2022-23, 2023-24 and from 2024-25);
    • the differential at every limit and threshold ±1p/£1 with four Class 1 amounts, in all 12 years;
    • the same differential as a Hypothesis property (6 derandomised examples of up to 16 people × 12 years).
  • ni_class_2.yaml (17 cases) and test_ni_class_2.py from Fix Class 2 NICs: 2023-24 rate, the 2022-23 lower profits threshold, and the small profits threshold #1888. Its regulation 100 pin no longer overrides the Class 4 parameters, since the defaults are now the statutory ones.

Effect

Single-person households at default parameters, main (8b2e6e1) against this branch (25bd7a9), each state run from its own worktree and venv.

Case Class 2 Class 4 Total NI
2023-24, £10,000 profits £163.80 → £0 £0 −£163.80
2023-24, £12,570 profits £163.80 → £0 £59.58 → £0 −£223.38
2023-24, £30,000 profits £163.80 → £179.40 £1,628.28 → £1,568.70 −£43.98
2023-24, £60,000 profits £163.80 → £179.40 £3,793.13 → £3,587.60 −£189.93
2023-24, £60,000 profits + £30,000 pay £163.80 → £179.40 £2,516.85 → £1,963.48 −£537.78
2023-24, £60,000 profits + £60,000 pay £163.80 → £179.40 £1,683.22 → £948.60 −£719.02
2022-23, £10,000 profits £163.80 → £0 £0 −£163.80
2022-23, £30,000 profits £163.80 £1,854.43 → £1,760.35 −£94.08
2022-23, £60,000 profits £163.80 £4,272.65 → £3,998.25 −£274.40
2022-23, £60,000 profits + £60,000 pay £163.80 £1,683.22 → £1,312.91 −£370.31
2015-16, £5,000 profits £145.60 → £0 £0 −£145.60
2015-16, £50,000 profits £145.60 £3,241.62 → £3,241.55 −£0.07
2024-25 and 2025-26, £60,000 profits £0 £2,456.60, unchanged 0
2026-27, £60,000 profits + £60,000 pay £0 £948.60, unchanged 0

Household net income moves by the negative of the NI change in every row, to within 1p.

Enhanced FRS. The dataset's base year is 2024-25, so it covers model years 2024 onward. In those years the only parameters that change are read by ni_class_2 alone: the small profits threshold (2024-25, and the 2027-28 to 2030-31 projection) and the two new lower-profits-threshold parameters. ni_class_2 multiplies them by a rate of zero. No other parameter read in 2024-2030 changes. I confirmed that with two real runs for each year from 2024 to 2030 (14 simulation-years), base against branch, each from its own worktree and venv on its own copy of the 2024-25 enhanced FRS (sha256 e433e532…).

  • No record changes in any year on any of the 12 outputs compared: ni_class_2, ni_class_4, ni_class_4_main, ni_class_4_maximum, ni_self_employed, ni_class_1_employee, national_insurance, income_tax, self_employment_income, household_net_income, household_tax and household_benefits.
  • In both states Class 2 is £0 in every year, and Class 4 is £2.57bn in 2024, £2.62bn in 2025 and £2.75bn in 2026.

The dataset has no year before 2024-25, so there is no aggregate figure for the 2015-16, 2022-23 and 2023-24 changes. The household table above shows their size.

Not in this PR

  • Class 1 in 2022-23 and 2023-24. The main primary rate and the primary threshold changed mid-year (6 July and 6 November 2022, 6 January 2024). The model samples them at 30 April. That is Mid-year parameter changes are dropped by fiscal year conversion #1807. It affects the Class 1 amount that regulation 100 subtracts for dual earners in those two years.
  • 52 contribution weeks. The model counts 52 Class 2 weeks in every year.
  • Voluntary Class 2 (s.11(6): £3.45, £3.50 and £3.65 from 2024-25) is not modelled. The flat-rate parameter describes compulsory liability only.

Axiom parity

axiom: TheAxiomFoundation/rulespec-uk#353 queued (s.11) | TheAxiomFoundation/rulespec-uk#423 queued (s.15 and reg 100)

rulespec-uk's uk/statutes/ukpga/1992/4/15.yaml and uk/regulations/uksi/2001/1004/100.yaml encode only the current text: limits from 2026-04-06, 6% from 2024-04-06 and a 2% additional rate from 2011 with no 2022-23 exception. None of the amending instruments are in the corpus. Both issues are dispatch-ready: module path, corpus citation, verbatim law, a figures table, a pasteable review_finding, and companion tests built on the same statutory figures as the tests here.

Verification of the figures

  • Point-in-time XML of s.11 and s.15 for 6 April of each year 2015–2026, and of regulation 100 at eight dates, fetched from legislation.gov.uk on 2 October 2026.
  • The made or enacted text of each amending instrument: SI 2015/588 art 3; SI 2016/343 reg 2; reg 5 of SIs 2017/415, 2018/337, 2019/262, 2020/299, 2021/157 and 2022/232; NICA 2011 s.2; NICs (Increase of Thresholds) Act 2022 ss.2-3; SI 2022/1329; Health and Social Care Levy Act 2021 s.5; the Repeal Act 2022 s.2 and Schedule; NICs (Reduction in Rates) Acts 2023 and 2024; SI 2024/377 regs 1 and 6.
  • legislation.gov.uk's point-in-time text does not show the 2022-23 rates, because the Repeal Act modifies s.15 for the year without amending its text. Those come from the Act itself.
  • The Class 2 figures were verified separately for Fix Class 2 NICs: 2023-24 rate, the 2022-23 lower profits threshold, and the small profits threshold #1888.

Independent review

Opus 5.5 via Subfleet (--task review --tier standard, job 20261002-081207-ni-class-2-4-review-r1): APPROVE WITH NITS, with nothing blocking.

The reviewer found:

  • every Class 2 and Class 4 figure for 2015-16 to 2026-27 matches s.11, s.15 and the amending instruments;
  • ni_class_2 and the regulation 100 formula follow the statutory text step by step;
  • every YAML expectation, hand-derived row and rulespec-uk#423 companion row it recomputed by hand is right.

Its findings and what I did:

  1. Hand-derived table missing cases. It lacked a Case 3 before 2022-23, a Case 2 in 2022-23 and a Case 3 in 2023-24. I added all three: £827.36, £3,998.25 and £1,748.60.
  2. The Enhanced FRS reasoning overstated "nothing changes". Reworded above. The zero-diff result stands.
  3. Possible conflict with Hold NICs thresholds at 2026-27 levels through 2030-31 #1959. Hold NICs thresholds at 2026-27 levels through 2030-31 #1959 merged first, and this branch is rebased on it.
  4. Nits, all fixed:
    • the £7,247 label;
    • "to within 1p" for the household rows;
    • changelog scope ("from 2015-16 to 2025-26");
    • the ni_class_4_maximum comment, which now says "from 2015-16" and that the 2024 Act changed only Steps Two and Five;
    • an Act name in ni_class_2.yaml;
    • the lower_profits_threshold_applies description;
    • the notebook table's reg 100 wording;
    • the Class 1 assumption behind the 2023-24 Case 3 YAML comment;
    • rulespec-uk#423 now lists NICA 2011 s.2 and says Change PolicyEngine label for "Claims UC" to "Claims Universal Credit" #353 must land first.

Commands run

  • ruff format --check . and ruff check .: clean.
  • policyengine-core test policyengine_uk/tests/policy/baseline/gov/hmrc -c policyengine_uk: 490 passed at 6cb67d6 (after the rebase onto Hold NICs thresholds at 2026-27 levels through 2030-31 #1959).
  • pytest policyengine_uk/tests/test_ni_class_2.py test_ni_class_4_statute.py test_ni_class_4_maximum.py test_ni_class_4_properties.py test_parameter_descriptions.py test_parameter_metadata.py test_fiscal_year_parameters.py test_build_metadata.py: 83 passed, 1 skipped at 25bd7a9; after the rebase and review fixes, test_ni_class_4_statute.py, test_ni_class_4_maximum.py and test_ni_class_2.py: 62 passed.
  • The Class 4 YAML run against main's Class 4 parameters: 8 failed, 2 passed.
  • PR Apply the income-related ESA and income-based JSA remunerative work conditions #2031's head (e38ea0c) with this PR's NI parameter, variable and test files overlaid: its ESA remunerative-work YAML and the NI YAML, 108 passed. That includes the 2023-24 case this fix was needed for (£12,500 profit, £7,300 personal pension: esa_exempt_work_earnings 170.19, esa_income_eligible false).
  • Not run locally: the full YAML suite to completion (a local run was stopped in the reform tests with no failure in the 232 files it had reached), the microsimulation tests and make documentation. CI runs all three.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits October 2, 2026 09:33
- 2023-24 weekly rate £3.45 (SI 2023/236 reg 3(a)); model year 2023
  charged £3.15.
- From 2022-23 Class 2 is payable only on profits that exceed the lower
  profits threshold (£11,908, SI 2022/1329; £12,570, SI 2023/236 reg
  3(b)). Profits from the small profits threshold up to it are treated
  as paid (s.11(5A)-(5B)); the model charged 52 weeks on them.
- Small profits threshold: £6,725 in 2023-24 and 2024-25 (not CPI
  uprated), £5,965 in 2015-16 and 2016-17 (not 3,965). CPI projections
  now run from the latest statutory value.
- Compulsory Class 2 ends 6 April 2024 (NICRRA 2023 s.3), not 1 January.
- Every value cites its amending instrument.
- Tests: YAML cases per year and threshold; a statute-table differential,
  range and monotonicity property test over model years 2015-2030; a
  2023-24 regulation 100 pin using the default £3.45 rate.
- NI notebook: describe the rule and regenerate saved charts; the rates
  chart now selects percentage parameters by unit.

Fixes #1887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 2023-24 lower profits limit £12,570 from 6 April 2023 (NICs (Increase
  of Thresholds) Act 2022 s.2(3)-(4)); model year 2023 used £11,908.
- 2022-23 main and additional rates 9.73% and 2.73% for the whole year
  (Health and Social Care Levy (Repeal) Act 2022 s.2(2)); the model used
  10.25% and 3.5%.
- 2023-24 additional rate 2% (s.15(3ZA)(b)); the model used 3.5%.
- 2015-16 upper profits limit £42,385 (SI 2015/588 art 3(b)), not
  £42,386; the £43,000 limit dated 6 April 2016 (SI 2016/343 reg 2).
- Main rate cut to 6% dated 6 April 2024 (NICRRA 2024 s.1(3)(a)).
- Every Class 4 limit and rate cites its amending instrument.
- Regulation 100 already reads the rate parameters; a comment records
  that its written percentages track the Class 4 rates in every year,
  including the 2022-23 modification (HSCL (Repeal) Act 2022 Sch para 6).
- Tests: the four stale 2023 YAML expectations replaced with hand-derived
  statutory values (ni_class_4 1,568.70; ni_class_4_main 3,393;
  ni_class_4_maximum 1,748.60 by reg 100 Case 3), plus 2022-23, 2015-16
  and 2016-17 cases; test_ni_class_4_statute.py adds a statute table for
  every year, 17 hand-derived liabilities and an exact-rational
  differential (s.15(3) capped by reg 100) at every limit and as a
  Hypothesis property.
- Docs: NI notebook chart values and the model-baseline link.

Fixes #1968

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Hand-derived table: add regulation 100 Case 3 before 2022-23 (2019-20,
  £827.36), Case 2 in 2022-23 (£3,998.25) and Case 3 in 2023-24
  (£1,748.60), so each regime has all three cases.
- ni_class_4_maximum comment: the percentages match from 2015-16; the 2024
  Act changed only Steps Two and Five.
- Class 4 maximum YAML: state the pay-spread assumption behind Case 3.
- lower_profits_threshold_applies description: the treated-as-paid band
  applied in 2022-23 and 2023-24.
- ni_class_2.yaml: Act name; changelog: citations run to 2025-26;
  notebook table: reg 100 also applied where Class 2 was paid before
  2024-25.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1959 holds the PT, UEL, LPL and UPL through 2030-31 and corrects the
2025-26 LEL to £125, but left the notebook's saved chart on the old
CPI-uprated values. Only the chart's y values change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant