Skip to content

Commit

Permalink
Add employer NI incidence (#961)
Browse files Browse the repository at this point in the history
* Add renames and employer NI logic

* Add employer NI logic

* Bump version

* Bump version

* Fix employer cost logic for emp_income < threshold

* Remove debugging line
  • Loading branch information
nikhilwoodruff authored Oct 16, 2024
1 parent a6316bd commit 660db83
Show file tree
Hide file tree
Showing 26 changed files with 492 additions and 487 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.0] - 2024-10-16 11:52:07

### Fixed

- Add employer NI incidence.

## [2.1.1] - 2024-09-18 11:12:23

## [2.1.0] - 2024-09-18 11:04:12
Expand Down Expand Up @@ -1488,6 +1494,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[2.2.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/PolicyEngine/openfisca-uk/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/PolicyEngine/openfisca-uk/compare/1.8.0...2.0.0
Expand Down
5 changes: 5 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1249,3 +1249,8 @@
removed:
- Survey-Enhance as a dependency.
date: 2024-09-18 11:12:23
- bump: minor
changes:
fixed:
- Add employer NI incidence.
date: 2024-10-16 11:52:07
4 changes: 0 additions & 4 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
- bump: minor
changes:
fixed:
- Set the Winter Fuel Allowance to only true in FY24-25.
67 changes: 67 additions & 0 deletions emp_ni_test.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from policyengine_uk import Simulation\n",
"from policyengine_core.reforms import Reform\n",
"\n",
"Reform.from_dict({\n",
" \"gov.hmrc.national_insurance.class_1.rates.employer\": {\n",
" \"year:2025:10\": 0.148,\n",
" },\n",
"}\n",
"\n",
"sim = Simulation(reform=), situation={\n",
" \"employment_income\": {\n",
" 2025: 40_000,\n",
" },\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([37500.], dtype=float32)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sim.calculate(\"employment_income\", 2025)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
70 changes: 70 additions & 0 deletions employer_ni.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Employer NI in PolicyEngine"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from policyengine_uk import Microsimulation"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"baseline = Microsimulation()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"baseline.calculate(\"employee_pension_contributions\").sum() / 1e9"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
132 changes: 132 additions & 0 deletions employer_ni_example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [],
"source": [
"from policyengine_uk import Simulation\n",
"from policyengine_core.reforms import Reform\n",
"\n",
"\n",
"def get_employer_cost(employment_income, ni_rate, ni_threshold):\n",
" return employment_income + ni_rate * (employment_income - ni_threshold)\n",
" raise_emp_ni = Reform.from_dict(\n",
" {\n",
" \"gov.hmrc.national_insurance.class_1.rates.employer\": {\n",
" \"2025-01-01.2030-01-01\": ni_rate\n",
" },\n",
" \"gov.hmrc.national_insurance.class_1.thresholds.secondary_threshold\": {\n",
" \"2025-01-01.2030-01-01\": ni_threshold\n",
" },\n",
" }\n",
" )\n",
"\n",
" raised_ni_simulation = Simulation(\n",
" situation={\n",
" \"employment_income\": employment_income,\n",
" },\n",
" reform=raise_emp_ni,\n",
" )\n",
"\n",
" # return employment_income + raised_ni_simulation.calculate(\"ni_employer\", 2025)[0]"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"45495.47096412556"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from policyengine_uk.system import system\n",
"\n",
"parameters = system.parameters(2025).gov.hmrc.national_insurance\n",
"\n",
"RATE = parameters.class_1.rates.employer # 13.8%\n",
"THRESHOLD = parameters.class_1.thresholds.secondary_threshold # 9100\n",
"\n",
"\n",
"def get_new_i(cost, rate, threshold):\n",
" return (cost + rate * threshold) / (1 + rate)\n",
"\n",
"\n",
"baseline_emp_cost = get_employer_cost(40_000, RATE, THRESHOLD)\n",
"baseline_emp_cost"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"39584.463443166314"
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_i = get_new_i(baseline_emp_cost, 0.15, THRESHOLD)\n",
"new_i"
]
},
{
"cell_type": "code",
"execution_count": 73,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"45495.47096412557"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"get_employer_cost(new_i, 0.15, THRESHOLD)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Employer NI
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: Assume that employers keep employment costs constant in response to employer NI changes.
values:
2010-01-01: true
metadata:
label: Employer NI employee incidence
unit: bool
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: Whether to exempt employer pension contributions from employer NI.
values:
2010-01-01: true
metadata:
unit: bool
label: exempt employer pension contributions from employers' NI
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ values:
- savings_income_tax
- dividend_income_tax
- CB_HITC
- private_pension_contributions_tax
- personal_pension_contributions_tax
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
description: Pensions programs
values:
0000-01-01:
- private_pension_contributions
- occupational_pension_contributions
- personal_pension_contributions
- employee_pension_contributions

metadata:
unit: list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
person:
age: 30
employment_income: 30_000
private_pension_contributions: 1_000
personal_pension_contributions: 1_000
weekly_hours: 20
benunits:
benunit:
Expand All @@ -30,7 +30,7 @@
person:
age: 30
employment_income: 3_000
private_pension_contributions: 1_000
personal_pension_contributions: 1_000
weekly_hours: 20
benunits:
benunit:
Expand Down Expand Up @@ -85,7 +85,7 @@
age: 20
weekly_hours: 25
employment_income: 12_000
private_pension_contributions: 57
personal_pension_contributions: 57
dla_m: 62.55 * 52
uc_limited_capability_for_WRA: true
person_2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
absolute_error_margin: 10
input:
employment_income: 34000
private_pension_contributions: 1200
personal_pension_contributions: 1200
output:
income_tax: (34000 - 1200 - 12500) * 0.2
Loading

0 comments on commit 660db83

Please sign in to comment.