From e1fa0866ec7fab64bb4e2885f3511996147cf5a4 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 14 Sep 2023 10:35:15 -0400 Subject: [PATCH 01/20] add documentation for income tax --- changelog_entry.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 37daeef19..d8a06ae4f 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -2,3 +2,4 @@ changes: added: - Update National Insurance documentation + - Update Income Tax documentation From 0200a4185202d6a916c0a2183af6cd6a3691a213 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 14 Sep 2023 10:38:07 -0400 Subject: [PATCH 02/20] Add documentation for income tax --- docs/book/programs/gov/hmrc/income_tax.ipynb | 1059 ++++++++++++++++++ 1 file changed, 1059 insertions(+) create mode 100644 docs/book/programs/gov/hmrc/income_tax.ipynb diff --git a/docs/book/programs/gov/hmrc/income_tax.ipynb b/docs/book/programs/gov/hmrc/income_tax.ipynb new file mode 100644 index 000000000..67bdaebee --- /dev/null +++ b/docs/book/programs/gov/hmrc/income_tax.ipynb @@ -0,0 +1,1059 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "SyCBxDvLJkZK" + }, + "source": [ + "# Income Tax" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "JODkfhOOLR45" + }, + "source": [ + "Income tax is a tax levied on the income earned by individuals and businesses. It is one of the primary sources of revenue for the UK government and is used to fund public services and government expenditures.\n", + "\n", + "This table shows the core components of the UK income tax:\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Gu96OiS8QwBu", + "outputId": "78f31024-25c7-44cd-c8fb-74f7ece243e2" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Category | Description |\n", + "+================+=================================================================================================================================================================================================+\n", + "| Tax Allowances | Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Blind Person’s Allowance, and Dividend Allowance. |\n", + "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Tax Charges | Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge. |\n", + "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Tax Rates | Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates. |\n", + "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", + "| Tax Reliefs | Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses. |\n", + "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "from tabulate import tabulate\n", + "\n", + "headers = [\"Category\", \"Description\"]\n", + "data = [\n", + " [\"Tax Allowances\", \"Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance.\"],\n", + " [\"Tax Charges\", \"Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge.\"],\n", + " [\"Tax Rates\", \"Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates.\"],\n", + " [\"Tax Reliefs\", \"Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\"]\n", + "]\n", + "\n", + "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ER87IhZtVPL6" + }, + "source": [ + "# Legislation" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "x9-zPzjkWT8k" + }, + "source": [ + "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC). This table briefly introduce the legislation of UK income tax:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "vInPOnY7WERk", + "outputId": "ef4bed84-45a9-4577-aa5d-f6a3abb81c47" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| Legislation | Description |\n", + "+==========================================================+=========================================================================================================================+\n", + "| Income Tax Act 2007 (ITA 2007) | Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| Taxation of Chargeable Gains Act 1992 (TCGA 1992) | Primarily about capital gains tax but intersects with income tax on the taxation of gains. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003) | Rules on taxation of employment income, pension income, and social security income. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| HMRC Manuals and Guidance | Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| Finance Acts | Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| Case Law | Court judgments shaping the interpretation and application of income tax legislation. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", + "| International Agreements | Double taxation treaties with other countries impacting taxation of UK and foreign residents. |\n", + "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "headers = [\"Legislation\", \"Description\"]\n", + "data = [\n", + " [\"Income Tax Act 2007 (ITA 2007)\", \"Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs.\"],\n", + " [\"Taxation of Chargeable Gains Act 1992 (TCGA 1992)\", \"Primarily about capital gains tax but intersects with income tax on the taxation of gains.\"],\n", + " [\"Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003)\", \"Rules on taxation of employment income, pension income, and social security income.\"],\n", + " [\"HMRC Manuals and Guidance\", \"Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight.\"],\n", + " [\"Finance Acts\", \"Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget.\"],\n", + " [\"Case Law\", \"Court judgments shaping the interpretation and application of income tax legislation.\"],\n", + " [\"International Agreements\", \"Double taxation treaties with other countries impacting taxation of UK and foreign residents.\"]\n", + "]\n", + "\n", + "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "VaL6XOutgEU4" + }, + "source": [ + "# Methodology:\n", + " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "7PgyfkG2kE-_" + }, + "source": [ + "- Tax Allowance:\\\n", + "This table shows some of variables used by PolicyEngine UK to model income tax allowances:" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "05DNxvPwgSRF", + "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| Variable Name | Label | Reference | Unit |\n", + "+============================================+=======================================================+===============================================================+========+\n", + "| personal_allowance | Personal Allowance for the year | Income Tax Act 2007 s. 35 | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| blind_persons_allowance | Blind Person's Allowance for the year (not simulated) | Income Tax Act 2007 s. 38 | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| trading_allowance | Trading Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| trading_allowance_deduction | Deduction applied by the trading allowance | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| property_allowance | Property Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783BF | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| savings_allowance | Savings Allowance for the year | Income Tax Act 2007 s. 12B | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| dividend_allowance | Dividend allowance for the person | Income Tax Act 2007 s. 13A | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| meets_marriage_allowance_income_conditions | Meets Marriage Allowance income conditions | https://www.legislation.gov.uk/ukpga/2007/3/section/55B | |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", + "| marriage_allowance | Marriage Allowance | https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A | GBP |\n", + "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n" + ] + } + ], + "source": [ + "# @title\n", + "from tabulate import tabulate\n", + "\n", + "variables = [\n", + " {\n", + " \"name\": \"personal_allowance\",\n", + " \"label\": \"Personal Allowance for the year\",\n", + " \"reference\": \"Income Tax Act 2007 s. 35\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"blind_persons_allowance\",\n", + " \"label\": \"Blind Person's Allowance for the year (not simulated)\",\n", + " \"reference\": \"Income Tax Act 2007 s. 38\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"trading_allowance\",\n", + " \"label\": \"Trading Allowance for the year\",\n", + " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"trading_allowance_deduction\",\n", + " \"label\": \"Deduction applied by the trading allowance\",\n", + " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"property_allowance\",\n", + " \"label\": \"Property Allowance for the year\",\n", + " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783BF\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"savings_allowance\",\n", + " \"label\": \"Savings Allowance for the year\",\n", + " \"reference\": \"Income Tax Act 2007 s. 12B\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"dividend_allowance\",\n", + " \"label\": \"Dividend allowance for the person\",\n", + " \"reference\": \"Income Tax Act 2007 s. 13A\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"name\": \"meets_marriage_allowance_income_conditions\",\n", + " \"label\": \"Meets Marriage Allowance income conditions\",\n", + " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/section/55B\",\n", + " \"unit\": \"\"\n", + " },\n", + " {\n", + " \"name\": \"marriage_allowance\",\n", + " \"label\": \"Marriage Allowance\",\n", + " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A\",\n", + " \"unit\": \"GBP\"\n", + " },\n", + "]\n", + "\n", + "headers = [\"Variable Name\", \"Label\", \"Reference\", \"Unit\"]\n", + "table_data = [(v[\"name\"], v[\"label\"], v[\"reference\"], v[\"unit\"]) for v in variables]\n", + "table = tabulate(table_data, headers=headers, tablefmt='grid')\n", + "\n", + "print(table)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "c0h8F-sRkybB" + }, + "source": [ + "- Tax Charges:\\\n", + "This table introduces the CB HITC methodology used by PolicyEngine UK to model tax charges.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "HFWPFr1qlrg6", + "outputId": "ae42e976-bec9-4f8b-cd72-45bdc2429f86" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+-------------+-------------------------------------------------------------------------+\n", + "| Component | Description |\n", + "+=============+=========================================================================+\n", + "| Entity | Person |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Value Type | Float |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Unit | GBP |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Period | YEAR |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Reference | https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8 |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Defined For | Higher Earner |\n", + "+-------------+-------------------------------------------------------------------------+\n", + "| Calculation | 1. Determine Child Benefit received. |\n", + "| | 2. Fetch CB HITC parameters. |\n", + "| | 3. Calculate % of CB to be recollected based on adjusted net income. |\n", + "| | 4. Return the lesser of the calculated % of CB or the full CB received. |\n", + "+-------------+-------------------------------------------------------------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "headers = ['Component', 'Description']\n", + "data = [\n", + " ['Entity', 'Person'],\n", + " ['Value Type', 'Float'],\n", + " ['Unit', 'GBP'],\n", + " ['Period', 'YEAR'],\n", + " ['Reference', 'https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8'],\n", + " ['Defined For', 'Higher Earner'],\n", + " ['Calculation', (\n", + " \"1. Determine Child Benefit received.\\n\"\n", + " \"2. Fetch CB HITC parameters.\\n\"\n", + " \"3. Calculate % of CB to be recollected based on adjusted net income.\\n\"\n", + " \"4. Return the lesser of the calculated % of CB or the full CB received.\"\n", + " )]\n", + "]\n", + "\n", + "print(tabulate(data, headers=headers, tablefmt='grid'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ugj-zQp1myCB" + }, + "source": [ + "- Base:\\\n", + "This table introduces the two classes (total_pension_income and social_security_income) used by PolicyEngine UK to model income tax." + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "PaqUIN6gtBQ5", + "outputId": "b0e20a52-2b2f-43f3-f6f8-36af95733da0" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| Variable Name | Label | Description/Components | Reference | Unit |\n", + "+========================+==============================================+===============================================================================+========================================================+========+\n", + "| total_pension_income | Total pension income | Private, personal and State Pension income | Income Tax Act 2007 s. 23 | GBP |\n", + "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| social_security_income | Income from social security for tax purposes | state_pension, incapacity_benefit, JSA_contrib, ESA_contrib, carers_allowance | Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b) | GBP |\n", + "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n" + ] + } + ], + "source": [ + "# @title\n", + "data = [\n", + " [\"Variable Name\", \"Label\", \"Description/Components\", \"Reference\", \"Unit\"],\n", + " [\"total_pension_income\",\n", + " \"Total pension income\",\n", + " \"Private, personal and State Pension income\",\n", + " \"Income Tax Act 2007 s. 23\",\n", + " \"GBP\"],\n", + " [\"social_security_income\",\n", + " \"Income from social security for tax purposes\",\n", + " \", \".join([\"state_pension\", \"incapacity_benefit\", \"JSA_contrib\", \"ESA_contrib\", \"carers_allowance\"]),\n", + " \"Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b)\",\n", + " \"GBP\"]\n", + "]\n", + "\n", + "table = tabulate(data, headers='firstrow', tablefmt='grid')\n", + "print(table)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "4Uw4aVRZtOW7" + }, + "source": [ + "- Liability\\\n", + "This table shows some of variables used by PolicyEngine UK to model income tax liability:" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "pskzpAi1ueD5", + "outputId": "6b5b35d4-1053-4992-a3c0-fdd84b963885" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| Variable Name | Label | Reference | Unit |\n", + "+=============================+=========================================================+=============================================+===========+\n", + "| earned_taxable_income | Non-savings, non-dividend income for Income Tax | Income Tax Act 2007 s. 10 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| earned_income_tax | Income tax on earned income | Income Tax Act 2007 s. 11 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| savings_starter_rate_income | Savings income which is tax-free under the starter rate | Income Tax Act 2007 s. 13 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| pension_annuity_income | Income from pensions and annuities | Pensions Act 2015 s. 14 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| property_rental_income | Income from renting out properties | Housing Act 1988 s. 4 | USD/month |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| dividend_income | Income from dividends | Companies Act 2006 s. 801 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", + "| capital_gains_income | Income from capital gains | Taxation of Chargeable Gains Act 1992 s. 20 | USD |\n", + "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n" + ] + } + ], + "source": [ + "# @title\n", + "variables_data = [\n", + " {\n", + " \"Variable Name\": \"earned_taxable_income\",\n", + " \"Label\": \"Non-savings, non-dividend income for Income Tax\",\n", + " \"Reference\": \"Income Tax Act 2007 s. 10\",\n", + " \"Unit\": \"USD\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"earned_income_tax\",\n", + " \"Label\": \"Income tax on earned income\",\n", + " \"Reference\": \"Income Tax Act 2007 s. 11\",\n", + " \"Unit\": \"USD\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"savings_starter_rate_income\",\n", + " \"Label\": \"Savings income which is tax-free under the starter rate\",\n", + " \"Reference\": \"Income Tax Act 2007 s. 13\",\n", + " \"Unit\": \"USD\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"pension_annuity_income\",\n", + " \"Label\": \"Income from pensions and annuities\",\n", + " \"Reference\": \"Pensions Act 2015 s. 14\",\n", + " \"Unit\": \"USD\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"property_rental_income\",\n", + " \"Label\": \"Income from renting out properties\",\n", + " \"Reference\": \"Housing Act 1988 s. 4\",\n", + " \"Unit\": \"USD/month\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"dividend_income\",\n", + " \"Label\": \"Income from dividends\",\n", + " \"Reference\": \"Companies Act 2006 s. 801\",\n", + " \"Unit\": \"USD\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"capital_gains_income\",\n", + " \"Label\": \"Income from capital gains\",\n", + " \"Reference\": \"Taxation of Chargeable Gains Act 1992 s. 20\",\n", + " \"Unit\": \"USD\"\n", + " }\n", + "]\n", + "\n", + "table = tabulate(variables_data, headers='keys', tablefmt=\"grid\")\n", + "\n", + "print(table)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "UUyN4ehR0zu6" + }, + "source": [ + "- Tax Relief\\\n", + "This table shows some of variables used by PolicyEngine UK to model income tax relief:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "KIwtvd6k2BBH", + "outputId": "50587fbd-7be1-49bd-a6c1-d42cd01edd1b" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| Variable Name | Label | Reference | Unit |\n", + "+=================================+====================================================================+========================================================+========+\n", + "| taxable_employment_income | Net taxable earnings | Income Tax (Earnings and Pensions) Act 2003 s. 11 | GBP |\n", + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| employment_deductions | Deductions from employment income | Income Tax Act (Earnings and Pensions) Act 2003 s. 327 | GBP |\n", + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| employment_expenses | Cost of expenses necessarily incurred and reimbursed by employment | Income Tax Act (Earnings and Pensions) Act 2003 s. 333 | GBP |\n", + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| taxable_savings_interest_income | Amount of savings interest which is taxable | Income Tax Act (Trading and Other Income) 2005 s. 369 | GBP |\n", + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", + "| taxable_pension_income | Amount of pension income that is taxable | Income Tax (Earnings and Pensions) Act 2003 s. 567 | GBP |\n", + "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n" + ] + } + ], + "source": [ + "# @title\n", + "selected_variables_data = [\n", + " {\n", + " \"Variable Name\": \"taxable_employment_income\",\n", + " \"Label\": \"Net taxable earnings\",\n", + " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 11\",\n", + " \"Unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"employment_deductions\",\n", + " \"Label\": \"Deductions from employment income\",\n", + " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 327\",\n", + " \"Unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"employment_expenses\",\n", + " \"Label\": \"Cost of expenses necessarily incurred and reimbursed by employment\",\n", + " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 333\",\n", + " \"Unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"taxable_savings_interest_income\",\n", + " \"Label\": \"Amount of savings interest which is taxable\",\n", + " \"Reference\": \"Income Tax Act (Trading and Other Income) 2005 s. 369\",\n", + " \"Unit\": \"GBP\"\n", + " },\n", + " {\n", + " \"Variable Name\": \"taxable_pension_income\",\n", + " \"Label\": \"Amount of pension income that is taxable\",\n", + " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 567\",\n", + " \"Unit\": \"GBP\"\n", + " }\n", + "]\n", + "\n", + "table = tabulate(selected_variables_data, headers='keys', tablefmt=\"grid\")\n", + "\n", + "print(table)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "DDa7lp9W3QVe" + }, + "source": [ + "# Appendix:\n", + "\n", + "The following tables and plot display the parameter values for income tax allowance." + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "xtGj1Z9q60Fs" + }, + "source": [ + "- Annual Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fSIiOJct5htX", + "outputId": "58536b69-9972-4e93-da3f-15643df20342" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+----------------+----------------------------------------------------------------+---------------------+\n", + "| Name | Description | Value |\n", + "+================+================================================================+=====================+\n", + "| default | Annual allowance for relief on pension contributions | 2015-06-01: 40,000 |\n", + "+----------------+----------------------------------------------------------------+---------------------+\n", + "| minimum | Minimum annual allowance for relief on pension contributions | 2015-06-01: 4,000 |\n", + "+----------------+----------------------------------------------------------------+---------------------+\n", + "| reduction_rate | Reduction rate for the annual allowance | 2015-06-01: 0.5 |\n", + "+----------------+----------------------------------------------------------------+---------------------+\n", + "| taper | Adjusted net income limit for tapering of the annual allowance | 2015-06-01: 240,000 |\n", + "+----------------+----------------------------------------------------------------+---------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "annual_allowance_data = [\n", + " {\n", + " \"Name\": \"default\",\n", + " \"Description\": \"Annual allowance for relief on pension contributions\",\n", + " \"Value\": \"2015-06-01: 40,000\"\n", + " },\n", + " {\n", + " \"Name\": \"minimum\",\n", + " \"Description\": \"Minimum annual allowance for relief on pension contributions\",\n", + " \"Value\": \"2015-06-01: 4,000\"\n", + " },\n", + " {\n", + " \"Name\": \"reduction_rate\",\n", + " \"Description\": \"Reduction rate for the annual allowance\",\n", + " \"Value\": \"2015-06-01: 0.5\"\n", + " },\n", + " {\n", + " \"Name\": \"taper\",\n", + " \"Description\": \"Adjusted net income limit for tapering of the annual allowance\",\n", + " \"Value\": \"2015-06-01: 240,000\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(annual_allowance_data, headers='keys', tablefmt='grid'))\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "AqNXJHHn7CkX" + }, + "source": [ + "- Marriage Allowance" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "oxTMKHBt7BVM", + "outputId": "6188d7d5-3579-4ffa-953b-f07be019cc65" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", + "| Name | Description | Value |\n", + "+====================+=====================================================================================================+==================+\n", + "| max | Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance | 2016-04-01: 10% |\n", + "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", + "| rounding_increment | The Marriage Allowance is rounded up by this increment. | 2016-04-01: 10 |\n", + "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", + "| takeup_rate | Percentage of eligible couples who claim Marriage Allowance. | 2000-01-01: 100% |\n", + "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "marriage_allowance_data = [\n", + " {\n", + " \"Name\": \"max\",\n", + " \"Description\": \"Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance\",\n", + " \"Value\": \"2016-04-01: 10%\"\n", + " },\n", + " {\n", + " \"Name\": \"rounding_increment\",\n", + " \"Description\": \"The Marriage Allowance is rounded up by this increment.\",\n", + " \"Value\": \"2016-04-01: 10\"\n", + " },\n", + " {\n", + " \"Name\": \"takeup_rate\",\n", + " \"Description\": \"Percentage of eligible couples who claim Marriage Allowance.\",\n", + " \"Value\": \"2000-01-01: 100%\",\n", + " }\n", + "]\n", + "\n", + "# Draw table using tabulate\n", + "print(tabulate(marriage_allowance_data, headers='keys', tablefmt='grid'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "_hc4HxX48IDd" + }, + "source": [ + "- Married Couple's Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "v2ORpQls8JrX", + "outputId": "7edb2f5e-8f19-426f-f717-9e5efe97f922" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n", + "| Name | Description | Value |\n", + "+================+============================================================================================+=================+\n", + "| deduction_rate | Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability | 2010-01-01: 10% |\n", + "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "married_couples_allowance_data = [\n", + " {\n", + " \"Name\": \"deduction_rate\",\n", + " \"Description\": \"Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability\",\n", + " \"Value\": \"2010-01-01: 10%\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(married_couples_allowance_data, headers='keys', tablefmt='grid'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "YlRfd5rI8cm9" + }, + "source": [ + "- Personal Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 542 + }, + "id": "MeT0diTy8d5d", + "outputId": "561c3d44-cc2a-43c3-8bdc-258cd5ea34ff" + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "\n", + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# @title\n", + "import plotly.express as px\n", + "import pandas as pd\n", + "\n", + "dates = ['2015-04-06', '2017-04-06', '2018-04-06', '2019-04-06', '2021-04-06', '2025-04-06']\n", + "values = [10600, 11500, 11850, 12500, 12570, 12570]\n", + "\n", + "df = pd.DataFrame({\n", + " 'Date': dates,\n", + " 'Allowance Amount': values\n", + "})\n", + "\n", + "fig = px.line(df, x='Date', y='Allowance Amount', title='Personal Allowance Over Time', markers=True)\n", + "fig.show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qmpkKy-a8-WU" + }, + "source": [ + "- Personal Savings Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "qSuYNkJi9CwG", + "outputId": "12ffcd0b-96eb-4822-a694-9939abace5ba" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+------------+-----------------------------------------------+--------------------+\n", + "| Name | Description | Value |\n", + "+============+===============================================+====================+\n", + "| additional | Savings allowance in the additional threshold | 2005-06-01: £0 |\n", + "+------------+-----------------------------------------------+--------------------+\n", + "| basic | Savings allowance in the basic threshold | 2005-06-01: £1,000 |\n", + "+------------+-----------------------------------------------+--------------------+\n", + "| higher | Savings allowance in the higher threshold | 2005-06-01: £500 |\n", + "+------------+-----------------------------------------------+--------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "personal_savings_allowance_data = [\n", + " {\n", + " \"Name\": \"additional\",\n", + " \"Description\": \"Savings allowance in the additional threshold\",\n", + " \"Value\": \"2005-06-01: 0\"\n", + " },\n", + " {\n", + " \"Name\": \"basic\",\n", + " \"Description\": \"Savings allowance in the basic threshold\",\n", + " \"Value\": \"2005-06-01: 1,000\"\n", + " },\n", + " {\n", + " \"Name\": \"higher\",\n", + " \"Description\": \"Savings allowance in the higher threshold\",\n", + " \"Value\": \"2005-06-01: 500\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(personal_savings_allowance_data, headers='keys', tablefmt='grid'))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "c47yF49J9eid" + }, + "source": [ + "- Dividend Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ebCKGBSX9hmD", + "outputId": "9e4602a3-1f1c-4deb-f78c-e5d4c5793773" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------+--------------------------------------------+--------------------+\n", + "| Name | Description | Value |\n", + "+====================+============================================+====================+\n", + "| dividend_allowance | Amount of dividend income untaxed per year | 2015-06-05: £2,000 |\n", + "+--------------------+--------------------------------------------+--------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "dividend_allowance_data = [\n", + " {\n", + " \"Name\": \"dividend_allowance\",\n", + " \"Description\": \"Amount of dividend income untaxed per year\",\n", + " \"Value\": \"2015-06-05: £2,000\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(dividend_allowance_data, headers='keys', tablefmt='grid'))" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "roxvVQx6CGgJ" + }, + "source": [ + "- Property Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "49dxnShlCl8z", + "outputId": "0f6d8363-44d9-4a37-8065-7199eafac8c3" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+--------------------+-------------------------------------------------+-------------------+\n", + "| Name | Description | Value |\n", + "+====================+=================================================+===================+\n", + "| property_allowance | Amount of income from property untaxed per year | 2005-06-01: 1,000 |\n", + "+--------------------+-------------------------------------------------+-------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "property_allowance_data = [\n", + " {\n", + " \"Name\": \"property_allowance\",\n", + " \"Description\": \"Amount of income from property untaxed per year\",\n", + " \"Value\": \"2005-06-01: 1,000\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(property_allowance_data, headers='keys', tablefmt='grid'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "SKBFVXmDCzMN" + }, + "source": [ + "- Trading Allowance:" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": { + "cellView": "form", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "CHKvIiE9C7Xh", + "outputId": "581780e5-7322-46a8-efc7-df62d1c7b24f" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "+-------------------+-------------------------------------------+-------------------+\n", + "| Name | Description | Value |\n", + "+===================+===========================================+===================+\n", + "| trading_allowance | Amount of trading income untaxed per year | 2005-06-01: 1,000 |\n", + "+-------------------+-------------------------------------------+-------------------+\n" + ] + } + ], + "source": [ + "# @title\n", + "trading_allowance_data = [\n", + " {\n", + " \"Name\": \"trading_allowance\",\n", + " \"Description\": \"Amount of trading income untaxed per year\",\n", + " \"Value\": \"2005-06-01: 1,000\"\n", + " }\n", + "]\n", + "\n", + "print(tabulate(trading_allowance_data, headers='keys', tablefmt='grid'))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "EsP8rEhFDppo" + }, + "source": [ + "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "name": "python", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} From cf8924640cf933a87054482d17134a2db59b6a7d Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 21 Sep 2023 04:18:02 -0400 Subject: [PATCH 03/20] update --- docs/book/_toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/book/_toc.yml b/docs/book/_toc.yml index 101ee4ffb..8a32ae183 100644 --- a/docs/book/_toc.yml +++ b/docs/book/_toc.yml @@ -10,6 +10,7 @@ parts: chapters: - file: programs/gov/hmrc/child-benefit - file: programs/gov/hmrc/national-insurance + - file: programs/gov/hmrc/income-tax - file: programs/gov/hmrc/fuel-duty - file: programs/contrib/ubi-center/carbon-tax - file: programs/gov/ofgem/energy-price-guarantee From cff0be8ed1308d08508efd084824a328aa9e24ca Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 21 Sep 2023 16:34:47 +0800 Subject: [PATCH 04/20] Update --- docs/book/_toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/book/_toc.yml b/docs/book/_toc.yml index 101ee4ffb..8a32ae183 100644 --- a/docs/book/_toc.yml +++ b/docs/book/_toc.yml @@ -10,6 +10,7 @@ parts: chapters: - file: programs/gov/hmrc/child-benefit - file: programs/gov/hmrc/national-insurance + - file: programs/gov/hmrc/income-tax - file: programs/gov/hmrc/fuel-duty - file: programs/contrib/ubi-center/carbon-tax - file: programs/gov/ofgem/energy-price-guarantee From ab1ba130c8d0016c18a59db9098d71eb65d25795 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Thu, 21 Sep 2023 16:25:50 +0100 Subject: [PATCH 05/20] Add Nikhil's comments and edits --- .../{income_tax.ipynb => income-tax.ipynb} | 245 ++++++++++++++---- 1 file changed, 194 insertions(+), 51 deletions(-) rename docs/book/programs/gov/hmrc/{income_tax.ipynb => income-tax.ipynb} (88%) diff --git a/docs/book/programs/gov/hmrc/income_tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb similarity index 88% rename from docs/book/programs/gov/hmrc/income_tax.ipynb rename to docs/book/programs/gov/hmrc/income-tax.ipynb index 67bdaebee..16416afc1 100644 --- a/docs/book/programs/gov/hmrc/income_tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "cellView": "form", "colab": { @@ -33,26 +33,71 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Category | Description |\n", - "+================+=================================================================================================================================================================================================+\n", - "| Tax Allowances | Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Blind Person’s Allowance, and Dividend Allowance. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Charges | Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Rates | Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Reliefs | Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
CategoryDescription
0Tax AllowancesAmount of income an individual can earn before...
1Tax ChargesLiabilities imposed when certain conditions or...
2Tax RatesPercentage of income taken as tax. There are d...
3Tax ReliefsProvisions to reduce tax liability. Examples i...
\n", + "
" + ], + "text/plain": [ + " Category Description\n", + "0 Tax Allowances Amount of income an individual can earn before...\n", + "1 Tax Charges Liabilities imposed when certain conditions or...\n", + "2 Tax Rates Percentage of income taken as tax. There are d...\n", + "3 Tax Reliefs Provisions to reduce tax liability. Examples i..." + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# @title\n", - "from tabulate import tabulate\n", + "import pandas as pd\n", "\n", "headers = [\"Category\", \"Description\"]\n", "data = [\n", @@ -62,13 +107,17 @@ " [\"Tax Reliefs\", \"Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\"]\n", "]\n", "\n", - "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" + "df = pd.DataFrame(data, columns=headers)\n", + "df\n" ] }, { "cell_type": "markdown", "metadata": { - "id": "ER87IhZtVPL6" + "id": "ER87IhZtVPL6", + "tags": [ + "hide-input" + ] }, "source": [ "# Legislation" @@ -141,8 +190,8 @@ "id": "VaL6XOutgEU4" }, "source": [ - "# Methodology:\n", - " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax." + "## Methodology\n", + "\n" ] }, { @@ -157,7 +206,41 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " earned_income_tax<2022, (default)> = [19432.]\n", + " pays_scottish_income_tax<2022, (default)> = [0.]\n", + " earned_taxable_income<2022, (default)> = [67430.]\n", + " earned_taxable_income<2022, (default)> = [67430.]\n" + ] + } + ], + "source": [ + "from policyengine_uk import Simulation\n", + "\n", + "simulation = Simulation(\n", + " situation={\n", + " \"people\": {\n", + " \"person\": {\n", + " \"employment_income\": 80_000,\n", + " \"dividend_income\": 20_000,\n", + " }\n", + " }\n", + " }\n", + ")\n", + "simulation.trace = True\n", + "simulation.calculate(\"earned_income_tax\")\n", + "simulation.tracer.print_computation_log(max_depth=2)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": { "cellView": "form", "colab": { @@ -168,39 +251,90 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+============================================+=======================================================+===============================================================+========+\n", - "| personal_allowance | Personal Allowance for the year | Income Tax Act 2007 s. 35 | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| blind_persons_allowance | Blind Person's Allowance for the year (not simulated) | Income Tax Act 2007 s. 38 | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| trading_allowance | Trading Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| trading_allowance_deduction | Deduction applied by the trading allowance | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| property_allowance | Property Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783BF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| savings_allowance | Savings Allowance for the year | Income Tax Act 2007 s. 12B | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| dividend_allowance | Dividend allowance for the person | Income Tax Act 2007 s. 13A | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| meets_marriage_allowance_income_conditions | Meets Marriage Allowance income conditions | https://www.legislation.gov.uk/ukpga/2007/3/section/55B | |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| marriage_allowance | Marriage Allowance | https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Variable NameLabelReferenceUnit
0personal_allowancePersonal Allowance for the year[Income Tax Act 2007 s. 35]currency-GBP
1blind_persons_allowanceBlind Person's Allowance for the year (not sim...[Income Tax Act 2007 s. 38]currency-GBP
\n", + "
" + ], + "text/plain": [ + " Variable Name Label \\\n", + "0 personal_allowance Personal Allowance for the year \n", + "1 blind_persons_allowance Blind Person's Allowance for the year (not sim... \n", + "\n", + " Reference Unit \n", + "0 [Income Tax Act 2007 s. 35] currency-GBP \n", + "1 [Income Tax Act 2007 s. 38] currency-GBP " + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ "# @title\n", "from tabulate import tabulate\n", + "from policyengine_uk.system import system\n", + "\n", + "VARIABLES = [ \n", + " \"personal_allowance\",\n", + " \"blind_persons_allowance\",\n", + "]\n", + "\n", + "variable_data = [system.variables[variable] for variable in VARIABLES]\n", "\n", "variables = [\n", " {\n", + " \"name\": variable.name,\n", + " \"label\": variable.label,\n", + " \"reference\": variable.reference,\n", + " \"unit\": variable.unit\n", + " }\n", + " for variable in variable_data\n", + "]\n", + "\"\"\"\n", + "variables = [\n", + " {\n", " \"name\": \"personal_allowance\",\n", " \"label\": \"Personal Allowance for the year\",\n", " \"reference\": \"Income Tax Act 2007 s. 35\",\n", @@ -254,13 +388,14 @@ " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A\",\n", " \"unit\": \"GBP\"\n", " },\n", - "]\n", + "]\"\"\"\n", "\n", "headers = [\"Variable Name\", \"Label\", \"Reference\", \"Unit\"]\n", "table_data = [(v[\"name\"], v[\"label\"], v[\"reference\"], v[\"unit\"]) for v in variables]\n", - "table = tabulate(table_data, headers=headers, tablefmt='grid')\n", + "import pandas as pd\n", "\n", - "print(table)\n" + "table = pd.DataFrame(table_data, columns=headers)\n", + "table\n" ] }, { @@ -1050,8 +1185,16 @@ "name": "python3" }, "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", "name": "python", - "version": "3.9.7" + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.12" } }, "nbformat": 4, From c7388c232fc45f9054d51bf481ed35463dc7e656 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 5 Oct 2023 04:45:03 -0400 Subject: [PATCH 06/20] adjust income tax doc --- docs/book/programs/gov/hmrc/income_tax.ipynb | 1279 +++++++++--------- 1 file changed, 631 insertions(+), 648 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income_tax.ipynb b/docs/book/programs/gov/hmrc/income_tax.ipynb index 67bdaebee..2c96020ff 100644 --- a/docs/book/programs/gov/hmrc/income_tax.ipynb +++ b/docs/book/programs/gov/hmrc/income_tax.ipynb @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": { "cellView": "form", "colab": { @@ -33,26 +33,70 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Category | Description |\n", - "+================+=================================================================================================================================================================================================+\n", - "| Tax Allowances | Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Blind Person’s Allowance, and Dividend Allowance. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Charges | Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Rates | Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n", - "| Tax Reliefs | Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses. |\n", - "+----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
CategoryDescription
0Tax AllowancesAmount of income an individual can earn before...
1Tax ChargesLiabilities imposed when certain conditions or...
2Tax RatesPercentage of income taken as tax. There are d...
3Tax ReliefsProvisions to reduce tax liability. Examples i...
\n", + "
" + ], + "text/plain": [ + " Category Description\n", + "0 Tax Allowances Amount of income an individual can earn before...\n", + "1 Tax Charges Liabilities imposed when certain conditions or...\n", + "2 Tax Rates Percentage of income taken as tax. There are d...\n", + "3 Tax Reliefs Provisions to reduce tax liability. Examples i..." + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", - "from tabulate import tabulate\n", + "import pandas as pd\n", "\n", "headers = [\"Category\", \"Description\"]\n", "data = [\n", @@ -62,7 +106,9 @@ " [\"Tax Reliefs\", \"Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\"]\n", "]\n", "\n", - "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" + "df = pd.DataFrame(data, columns=headers)\n", + "df\n", + "\n" ] }, { @@ -71,7 +117,7 @@ "id": "ER87IhZtVPL6" }, "source": [ - "# Legislation" + "## Legislation" ] }, { @@ -80,493 +126,99 @@ "id": "x9-zPzjkWT8k" }, "source": [ - "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC). This table briefly introduce the legislation of UK income tax:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "vInPOnY7WERk", - "outputId": "ef4bed84-45a9-4577-aa5d-f6a3abb81c47" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Legislation | Description |\n", - "+==========================================================+=========================================================================================================================+\n", - "| Income Tax Act 2007 (ITA 2007) | Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Taxation of Chargeable Gains Act 1992 (TCGA 1992) | Primarily about capital gains tax but intersects with income tax on the taxation of gains. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003) | Rules on taxation of employment income, pension income, and social security income. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| HMRC Manuals and Guidance | Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Finance Acts | Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Case Law | Court judgments shaping the interpretation and application of income tax legislation. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| International Agreements | Double taxation treaties with other countries impacting taxation of UK and foreign residents. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n" - ] - } - ], - "source": [ - "# @title\n", - "headers = [\"Legislation\", \"Description\"]\n", - "data = [\n", - " [\"Income Tax Act 2007 (ITA 2007)\", \"Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs.\"],\n", - " [\"Taxation of Chargeable Gains Act 1992 (TCGA 1992)\", \"Primarily about capital gains tax but intersects with income tax on the taxation of gains.\"],\n", - " [\"Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003)\", \"Rules on taxation of employment income, pension income, and social security income.\"],\n", - " [\"HMRC Manuals and Guidance\", \"Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight.\"],\n", - " [\"Finance Acts\", \"Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget.\"],\n", - " [\"Case Law\", \"Court judgments shaping the interpretation and application of income tax legislation.\"],\n", - " [\"International Agreements\", \"Double taxation treaties with other countries impacting taxation of UK and foreign residents.\"]\n", - "]\n", + "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC).\n", "\n", - "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "VaL6XOutgEU4" - }, - "source": [ - "# Methodology:\n", - " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "7PgyfkG2kE-_" - }, - "source": [ - "- Tax Allowance:\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax allowances:" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "05DNxvPwgSRF", - "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+============================================+=======================================================+===============================================================+========+\n", - "| personal_allowance | Personal Allowance for the year | Income Tax Act 2007 s. 35 | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| blind_persons_allowance | Blind Person's Allowance for the year (not simulated) | Income Tax Act 2007 s. 38 | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| trading_allowance | Trading Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| trading_allowance_deduction | Deduction applied by the trading allowance | Income Tax (Trading and Other Income) Act 2005 s. 783AF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| property_allowance | Property Allowance for the year | Income Tax (Trading and Other Income) Act 2005 s. 783BF | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| savings_allowance | Savings Allowance for the year | Income Tax Act 2007 s. 12B | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| dividend_allowance | Dividend allowance for the person | Income Tax Act 2007 s. 13A | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| meets_marriage_allowance_income_conditions | Meets Marriage Allowance income conditions | https://www.legislation.gov.uk/ukpga/2007/3/section/55B | |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n", - "| marriage_allowance | Marriage Allowance | https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A | GBP |\n", - "+--------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------+--------+\n" - ] - } - ], - "source": [ - "# @title\n", - "from tabulate import tabulate\n", + "- Income Tax Act 2007 (ITA 2007):\n", + "This is a central piece of legislation consolidating various statutes related to income tax in the UK. It comprehensively covers aspects such as the charge to tax, applicable rates, allowances, and reliefs, serving as a foundational reference for income tax matters.\n", "\n", - "variables = [\n", - " {\n", - " \"name\": \"personal_allowance\",\n", - " \"label\": \"Personal Allowance for the year\",\n", - " \"reference\": \"Income Tax Act 2007 s. 35\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"blind_persons_allowance\",\n", - " \"label\": \"Blind Person's Allowance for the year (not simulated)\",\n", - " \"reference\": \"Income Tax Act 2007 s. 38\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"trading_allowance\",\n", - " \"label\": \"Trading Allowance for the year\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"trading_allowance_deduction\",\n", - " \"label\": \"Deduction applied by the trading allowance\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"property_allowance\",\n", - " \"label\": \"Property Allowance for the year\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783BF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"savings_allowance\",\n", - " \"label\": \"Savings Allowance for the year\",\n", - " \"reference\": \"Income Tax Act 2007 s. 12B\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"dividend_allowance\",\n", - " \"label\": \"Dividend allowance for the person\",\n", - " \"reference\": \"Income Tax Act 2007 s. 13A\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"meets_marriage_allowance_income_conditions\",\n", - " \"label\": \"Meets Marriage Allowance income conditions\",\n", - " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/section/55B\",\n", - " \"unit\": \"\"\n", - " },\n", - " {\n", - " \"name\": \"marriage_allowance\",\n", - " \"label\": \"Marriage Allowance\",\n", - " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - "]\n", + "- Taxation of Chargeable Gains Act 1992 (TCGA 1992):\n", + "Though primarily focused on capital gains tax, this Act intersects significantly with income tax, particularly in the realm of taxation of gains. It provides detailed regulations on how gains should be taxed and calculated.\n", "\n", - "headers = [\"Variable Name\", \"Label\", \"Reference\", \"Unit\"]\n", - "table_data = [(v[\"name\"], v[\"label\"], v[\"reference\"], v[\"unit\"]) for v in variables]\n", - "table = tabulate(table_data, headers=headers, tablefmt='grid')\n", + "- Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003):\n", + "ITEPA 2003 governs the rules related to the taxation of employment income, pension income, and social security income. It outlines the various categories and criteria for taxable earnings and pensions, ensuring a structured approach to taxation in these areas.\n", "\n", - "print(table)\n" + "- HMRC Manuals and Guidance:\n", + "Produced by HMRC, these comprehensive guides aim to help taxpayers in understanding and complying with the complex tax legislation. They provide practical insights and interpretations of the laws, offering clarity and assistance to both individuals and businesses in navigating the income tax landscape.\n", + "\n" ] }, { "cell_type": "markdown", "metadata": { - "id": "c0h8F-sRkybB" - }, - "source": [ - "- Tax Charges:\\\n", - "This table introduces the CB HITC methodology used by PolicyEngine UK to model tax charges.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "HFWPFr1qlrg6", - "outputId": "ae42e976-bec9-4f8b-cd72-45bdc2429f86" + "id": "VaL6XOutgEU4" }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-------------+-------------------------------------------------------------------------+\n", - "| Component | Description |\n", - "+=============+=========================================================================+\n", - "| Entity | Person |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Value Type | Float |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Unit | GBP |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Period | YEAR |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Reference | https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8 |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Defined For | Higher Earner |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Calculation | 1. Determine Child Benefit received. |\n", - "| | 2. Fetch CB HITC parameters. |\n", - "| | 3. Calculate % of CB to be recollected based on adjusted net income. |\n", - "| | 4. Return the lesser of the calculated % of CB or the full CB received. |\n", - "+-------------+-------------------------------------------------------------------------+\n" - ] - } - ], "source": [ - "# @title\n", - "headers = ['Component', 'Description']\n", - "data = [\n", - " ['Entity', 'Person'],\n", - " ['Value Type', 'Float'],\n", - " ['Unit', 'GBP'],\n", - " ['Period', 'YEAR'],\n", - " ['Reference', 'https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8'],\n", - " ['Defined For', 'Higher Earner'],\n", - " ['Calculation', (\n", - " \"1. Determine Child Benefit received.\\n\"\n", - " \"2. Fetch CB HITC parameters.\\n\"\n", - " \"3. Calculate % of CB to be recollected based on adjusted net income.\\n\"\n", - " \"4. Return the lesser of the calculated % of CB or the full CB received.\"\n", - " )]\n", - "]\n", + "## Methodology:\n", "\n", - "print(tabulate(data, headers=headers, tablefmt='grid'))\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "ugj-zQp1myCB" - }, - "source": [ - "- Base:\\\n", - "This table introduces the two classes (total_pension_income and social_security_income) used by PolicyEngine UK to model income tax." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "PaqUIN6gtBQ5", - "outputId": "b0e20a52-2b2f-43f3-f6f8-36af95733da0" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| Variable Name | Label | Description/Components | Reference | Unit |\n", - "+========================+==============================================+===============================================================================+========================================================+========+\n", - "| total_pension_income | Total pension income | Private, personal and State Pension income | Income Tax Act 2007 s. 23 | GBP |\n", - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| social_security_income | Income from social security for tax purposes | state_pension, incapacity_benefit, JSA_contrib, ESA_contrib, carers_allowance | Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b) | GBP |\n", - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n" - ] - } - ], - "source": [ - "# @title\n", - "data = [\n", - " [\"Variable Name\", \"Label\", \"Description/Components\", \"Reference\", \"Unit\"],\n", - " [\"total_pension_income\",\n", - " \"Total pension income\",\n", - " \"Private, personal and State Pension income\",\n", - " \"Income Tax Act 2007 s. 23\",\n", - " \"GBP\"],\n", - " [\"social_security_income\",\n", - " \"Income from social security for tax purposes\",\n", - " \", \".join([\"state_pension\", \"incapacity_benefit\", \"JSA_contrib\", \"ESA_contrib\", \"carers_allowance\"]),\n", - " \"Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b)\",\n", - " \"GBP\"]\n", - "]\n", + " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax.\n", "\n", - "table = tabulate(data, headers='firstrow', tablefmt='grid')\n", - "print(table)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "4Uw4aVRZtOW7" - }, - "source": [ - "- Liability\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax liability:" + "The following table shows a series of income tax simulations using the PolicyEngine UK model." ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 34, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, - "id": "pskzpAi1ueD5", - "outputId": "6b5b35d4-1053-4992-a3c0-fdd84b963885" + "id": "05DNxvPwgSRF", + "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+=============================+=========================================================+=============================================+===========+\n", - "| earned_taxable_income | Non-savings, non-dividend income for Income Tax | Income Tax Act 2007 s. 10 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| earned_income_tax | Income tax on earned income | Income Tax Act 2007 s. 11 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| savings_starter_rate_income | Savings income which is tax-free under the starter rate | Income Tax Act 2007 s. 13 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| pension_annuity_income | Income from pensions and annuities | Pensions Act 2015 s. 14 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| property_rental_income | Income from renting out properties | Housing Act 1988 s. 4 | USD/month |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| dividend_income | Income from dividends | Companies Act 2006 s. 801 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| capital_gains_income | Income from capital gains | Taxation of Chargeable Gains Act 1992 s. 20 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n" + "ename": "ImportError", + "evalue": "cannot import name 'is_path' from 'PIL._util' (/Users/wangxi/opt/anaconda3/lib/python3.9/site-packages/PIL/_util.py)", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/x2/71ydg8jd7b3bbw26tjh3df5c0000gn/T/ipykernel_12669/4239097814.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_uk\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mcalculate_income_tax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0memployment_income\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdividend_income\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m simulation = Simulation(\n\u001b[1;32m 5\u001b[0m situation={\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_uk/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_uk\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mentities\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m from policyengine_uk.system import (\n\u001b[1;32m 6\u001b[0m \u001b[0mCountryTaxBenefitSystem\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_uk/entities.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# This file defines the entities needed by our legislation.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mentities\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mbuild_entity\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m State = build_entity(\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msimulations\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicrosimulation\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtaxbenefitsystems\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTaxBenefitSystem\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/simulations/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mtransform_to_strict_syntax\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m )\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mmicrosimulation\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicrosimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0msimulation\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0msimulation_builder\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulationBuilder\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/simulations/microsimulation.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mtyping\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mType\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmicrodf\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicroDataFrame\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mMicroSeries\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdataset\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/microdf/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0magg\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0magg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcombine_base_reform\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpctchg_base_reform\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mchart_utils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdollar_format\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcurrency_format\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mcharts\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mquantile_pct_chg_plot\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mconcat\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconcat\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m from .constants import (\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/microdf/chart_utils.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mmpl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdollar_format\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msuffix\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \"\"\"Dollar formatter for matplotlib.\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[0;31m# cbook must import matplotlib only within function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 160\u001b[0m \u001b[0;31m# definitions, so it is safe to import from it here.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 161\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_api\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_version\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_docstring\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrcsetup\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 162\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcbook\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msanitize_sequence\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 163\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_api\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMatplotlibDeprecationWarning\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/rcsetup.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_api\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcbook\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mls_mapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolors\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mColormap\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mis_color_like\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_fontconfig_pattern\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mparse_fontconfig_pattern\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_enums\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mJoinStyle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mCapStyle\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/colors.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 52\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mPIL\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 53\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mPIL\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPngImagePlugin\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPngInfo\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mmpl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/PIL/PngImagePlugin.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0menum\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mIntEnum\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageChops\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageFile\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImagePalette\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageSequence\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 43\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_binary\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mi16be\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mi16\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_binary\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mi32be\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mi32\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/PIL/ImageFile.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 35\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 36\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_util\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mis_path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 37\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[0mMAXBLOCK\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m65536\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mImportError\u001b[0m: cannot import name 'is_path' from 'PIL._util' (/Users/wangxi/opt/anaconda3/lib/python3.9/site-packages/PIL/_util.py)" ] } ], "source": [ - "# @title\n", - "variables_data = [\n", - " {\n", - " \"Variable Name\": \"earned_taxable_income\",\n", - " \"Label\": \"Non-savings, non-dividend income for Income Tax\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 10\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"earned_income_tax\",\n", - " \"Label\": \"Income tax on earned income\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 11\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"savings_starter_rate_income\",\n", - " \"Label\": \"Savings income which is tax-free under the starter rate\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 13\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"pension_annuity_income\",\n", - " \"Label\": \"Income from pensions and annuities\",\n", - " \"Reference\": \"Pensions Act 2015 s. 14\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"property_rental_income\",\n", - " \"Label\": \"Income from renting out properties\",\n", - " \"Reference\": \"Housing Act 1988 s. 4\",\n", - " \"Unit\": \"USD/month\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"dividend_income\",\n", - " \"Label\": \"Income from dividends\",\n", - " \"Reference\": \"Companies Act 2006 s. 801\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"capital_gains_income\",\n", - " \"Label\": \"Income from capital gains\",\n", - " \"Reference\": \"Taxation of Chargeable Gains Act 1992 s. 20\",\n", - " \"Unit\": \"USD\"\n", - " }\n", - "]\n", + "from policyengine_uk import Simulation\n", "\n", - "table = tabulate(variables_data, headers='keys', tablefmt=\"grid\")\n", + "def calculate_income_tax(employment_income, dividend_income):\n", + " simulation = Simulation(\n", + " situation={\n", + " \"people\": {\n", + " \"person\": {\n", + " \"employment_income\": employment_income,\n", + " \"dividend_income\": dividend_income,\n", + " }\n", + " }\n", + " }\n", + " )\n", + " return simulation.calculate(\"income_tax\")\n", "\n", - "print(table)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "UUyN4ehR0zu6" - }, - "source": [ - "- Tax Relief\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax relief:\n" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "KIwtvd6k2BBH", - "outputId": "50587fbd-7be1-49bd-a6c1-d42cd01edd1b" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+=================================+====================================================================+========================================================+========+\n", - "| taxable_employment_income | Net taxable earnings | Income Tax (Earnings and Pensions) Act 2003 s. 11 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| employment_deductions | Deductions from employment income | Income Tax Act (Earnings and Pensions) Act 2003 s. 327 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| employment_expenses | Cost of expenses necessarily incurred and reimbursed by employment | Income Tax Act (Earnings and Pensions) Act 2003 s. 333 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| taxable_savings_interest_income | Amount of savings interest which is taxable | Income Tax Act (Trading and Other Income) 2005 s. 369 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| taxable_pension_income | Amount of pension income that is taxable | Income Tax (Earnings and Pensions) Act 2003 s. 567 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n" - ] - } - ], - "source": [ - "# @title\n", - "selected_variables_data = [\n", - " {\n", - " \"Variable Name\": \"taxable_employment_income\",\n", - " \"Label\": \"Net taxable earnings\",\n", - " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 11\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"employment_deductions\",\n", - " \"Label\": \"Deductions from employment income\",\n", - " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 327\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"employment_expenses\",\n", - " \"Label\": \"Cost of expenses necessarily incurred and reimbursed by employment\",\n", - " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 333\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"taxable_savings_interest_income\",\n", - " \"Label\": \"Amount of savings interest which is taxable\",\n", - " \"Reference\": \"Income Tax Act (Trading and Other Income) 2005 s. 369\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"taxable_pension_income\",\n", - " \"Label\": \"Amount of pension income that is taxable\",\n", - " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 567\",\n", - " \"Unit\": \"GBP\"\n", - " }\n", - "]\n", + "data = {\n", + " \"Person\": [\"Person 1\", \"Person 2\", \"Person 3\", \"Person 4\", \"Person 5\"],\n", + " \"Employment Income (£)\": [80000, 50000, 60000, 90000, 75000],\n", + " \"Dividend Income (£)\": [20000, 15000, 10000, 25000, 20000],\n", + " \"Income Tax (£)\": []\n", + "}\n", "\n", - "table = tabulate(selected_variables_data, headers='keys', tablefmt=\"grid\")\n", + "for emp_income, div_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"]):\n", + " data[\"Income Tax (£)\"].append(calculate_income_tax(emp_income, div_income))\n", "\n", - "print(table)\n" + "df = pd.DataFrame(data)\n", + "df\n" ] }, { @@ -575,9 +227,9 @@ "id": "DDa7lp9W3QVe" }, "source": [ - "# Appendix:\n", + "## Appendix:\n", "\n", - "The following tables and plot display the parameter values for income tax allowance." + "The following tables display the parameter values for income tax allowance." ] }, { @@ -591,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 17, "metadata": { "cellView": "form", "colab": { @@ -602,50 +254,102 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| Name | Description | Value |\n", - "+================+================================================================+=====================+\n", - "| default | Annual allowance for relief on pension contributions | 2015-06-01: 40,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| minimum | Minimum annual allowance for relief on pension contributions | 2015-06-01: 4,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| reduction_rate | Reduction rate for the annual allowance | 2015-06-01: 0.5 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| taper | Adjusted net income limit for tapering of the annual allowance | 2015-06-01: 240,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0default2015-06-01: 40,000currency-GBP
1minimum2015-06-01: 4,000currency-GBP
2reduction_rate2015-06-01: 0.5marginal-rate
3taper2015-06-01: 240,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 default 2015-06-01: 40,000 currency-GBP\n", + "1 minimum 2015-06-01: 4,000 currency-GBP\n", + "2 reduction_rate 2015-06-01: 0.5 marginal-rate\n", + "3 taper 2015-06-01: 240,000 currency-GBP" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "annual_allowance_data = [\n", " {\n", " \"Name\": \"default\",\n", - " \"Description\": \"Annual allowance for relief on pension contributions\",\n", - " \"Value\": \"2015-06-01: 40,000\"\n", + " \"Value\": \"2015-06-01: 40,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", + "\n", " {\n", " \"Name\": \"minimum\",\n", - " \"Description\": \"Minimum annual allowance for relief on pension contributions\",\n", - " \"Value\": \"2015-06-01: 4,000\"\n", + " \"Value\": \"2015-06-01: 4,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", + "\n", " {\n", " \"Name\": \"reduction_rate\",\n", - " \"Description\": \"Reduction rate for the annual allowance\",\n", - " \"Value\": \"2015-06-01: 0.5\"\n", + " \"Value\": \"2015-06-01: 0.5\",\n", + " \"Unit\": \"marginal-rate\"\n", + "\n", " },\n", " {\n", " \"Name\": \"taper\",\n", - " \"Description\": \"Adjusted net income limit for tapering of the annual allowance\",\n", - " \"Value\": \"2015-06-01: 240,000\"\n", + " \"Value\": \"2015-06-01: 240,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(annual_allowance_data, headers='keys', tablefmt='grid'))\n", - "\n" + "df = pd.DataFrame(annual_allowance_data)\n", + "df\n" ] }, { @@ -659,7 +363,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 20, "metadata": { "cellView": "form", "colab": { @@ -670,43 +374,88 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| Name | Description | Value |\n", - "+====================+=====================================================================================================+==================+\n", - "| max | Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance | 2016-04-01: 10% |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| rounding_increment | The Marriage Allowance is rounded up by this increment. | 2016-04-01: 10 |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| takeup_rate | Percentage of eligible couples who claim Marriage Allowance. | 2000-01-01: 100% |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0max2016-04-01: 0.1/1
1rounding_increment2016-04-01: 10currency-GBP
2takeup_rate2000-01-01: 1/1
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 max 2016-04-01: 0.1 /1\n", + "1 rounding_increment 2016-04-01: 10 currency-GBP\n", + "2 takeup_rate 2000-01-01: 1 /1" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "marriage_allowance_data = [\n", " {\n", " \"Name\": \"max\",\n", - " \"Description\": \"Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance\",\n", - " \"Value\": \"2016-04-01: 10%\"\n", + " \"Value\": \"2016-04-01: 0.1\",\n", + " \"Unit\": \"/1\"\n", " },\n", " {\n", " \"Name\": \"rounding_increment\",\n", - " \"Description\": \"The Marriage Allowance is rounded up by this increment.\",\n", - " \"Value\": \"2016-04-01: 10\"\n", + " \"Value\": \"2016-04-01: 10\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", " \"Name\": \"takeup_rate\",\n", - " \"Description\": \"Percentage of eligible couples who claim Marriage Allowance.\",\n", - " \"Value\": \"2000-01-01: 100%\",\n", + " \"Value\": \"2000-01-01: 1\",\n", + " \"Unit\": \"/1\"\n", " }\n", "]\n", "\n", - "# Draw table using tabulate\n", - "print(tabulate(marriage_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(marriage_allowance_data)\n", + "df\n", + "\n" ] }, { @@ -720,7 +469,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 25, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -730,28 +479,64 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n", - "| Name | Description | Value |\n", - "+================+============================================================================================+=================+\n", - "| deduction_rate | Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability | 2010-01-01: 10% |\n", - "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0deduction_rate2010-01-01: 10%/1
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 deduction_rate 2010-01-01: 10% /1" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "married_couples_allowance_data = [\n", " {\n", " \"Name\": \"deduction_rate\",\n", - " \"Description\": \"Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability\",\n", - " \"Value\": \"2010-01-01: 10%\"\n", + " \"Value\": \"2010-01-01: 10%\",\n", + " \"Unit\": \"/1\"\n", " }\n", "]\n", "\n", - "print(tabulate(married_couples_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(married_couples_allowance_data)\n", + "df\n", + "\n" ] }, { @@ -765,7 +550,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 28, "metadata": { "cellView": "form", "colab": { @@ -779,58 +564,97 @@ { "data": { "text/html": [ - "\n", - "\n", - "\n", - "
\n", - "
\n", - "\n", - "" + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
DateAllowance AmountUnit
02015-04-0610600currency-GBP
12017-04-0611500currency-GBP
22018-04-0611850currency-GBP
32019-04-0612500currency-GBP
42021-04-0612570currency-GBP
52025-04-0612570currency-GBP
\n", + "" + ], + "text/plain": [ + " Date Allowance Amount Unit\n", + "0 2015-04-06 10600 currency-GBP\n", + "1 2017-04-06 11500 currency-GBP\n", + "2 2018-04-06 11850 currency-GBP\n", + "3 2019-04-06 12500 currency-GBP\n", + "4 2021-04-06 12570 currency-GBP\n", + "5 2025-04-06 12570 currency-GBP" ] }, + "execution_count": 28, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ - "# @title\n", - "import plotly.express as px\n", - "import pandas as pd\n", - "\n", "dates = ['2015-04-06', '2017-04-06', '2018-04-06', '2019-04-06', '2021-04-06', '2025-04-06']\n", "values = [10600, 11500, 11850, 12500, 12570, 12570]\n", "\n", "df = pd.DataFrame({\n", " 'Date': dates,\n", - " 'Allowance Amount': values\n", + " 'Allowance Amount': values,\n", + " 'Unit': \"currency-GBP\"\n", "})\n", "\n", - "fig = px.line(df, x='Date', y='Allowance Amount', title='Personal Allowance Over Time', markers=True)\n", - "fig.show()\n" + "df\n", + "\n" ] }, { @@ -844,7 +668,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 29, "metadata": { "cellView": "form", "colab": { @@ -855,42 +679,89 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+------------+-----------------------------------------------+--------------------+\n", - "| Name | Description | Value |\n", - "+============+===============================================+====================+\n", - "| additional | Savings allowance in the additional threshold | 2005-06-01: £0 |\n", - "+------------+-----------------------------------------------+--------------------+\n", - "| basic | Savings allowance in the basic threshold | 2005-06-01: £1,000 |\n", - "+------------+-----------------------------------------------+--------------------+\n", - "| higher | Savings allowance in the higher threshold | 2005-06-01: £500 |\n", - "+------------+-----------------------------------------------+--------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0additional threshold2005-06-01: 0currency-GBP
1basic threshold2005-06-01: 1,000currency-GBP
2higher threshold2005-06-01: 500currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 additional threshold 2005-06-01: 0 currency-GBP\n", + "1 basic threshold 2005-06-01: 1,000 currency-GBP\n", + "2 higher threshold 2005-06-01: 500 currency-GBP" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "personal_savings_allowance_data = [\n", " {\n", - " \"Name\": \"additional\",\n", - " \"Description\": \"Savings allowance in the additional threshold\",\n", - " \"Value\": \"2005-06-01: 0\"\n", + " \"Name\": \"additional threshold\",\n", + " \"Value\": \"2005-06-01: 0\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", - " \"Name\": \"basic\",\n", - " \"Description\": \"Savings allowance in the basic threshold\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Name\": \"basic threshold\",\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", - " \"Name\": \"higher\",\n", - " \"Description\": \"Savings allowance in the higher threshold\",\n", - " \"Value\": \"2005-06-01: 500\"\n", + " \"Name\": \"higher threshold\",\n", + " \"Value\": \"2005-06-01: 500\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(personal_savings_allowance_data, headers='keys', tablefmt='grid'))" + "df = pd.DataFrame(personal_savings_allowance_data)\n", + "df\n", + "\n", + "\n" ] }, { @@ -904,7 +775,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 30, "metadata": { "cellView": "form", "colab": { @@ -915,28 +786,63 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+--------------------------------------------+--------------------+\n", - "| Name | Description | Value |\n", - "+====================+============================================+====================+\n", - "| dividend_allowance | Amount of dividend income untaxed per year | 2015-06-05: £2,000 |\n", - "+--------------------+--------------------------------------------+--------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0dividend_allowance2015-06-05: 2,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 dividend_allowance 2015-06-05: 2,000 currency-GBP" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "dividend_allowance_data = [\n", " {\n", " \"Name\": \"dividend_allowance\",\n", - " \"Description\": \"Amount of dividend income untaxed per year\",\n", - " \"Value\": \"2015-06-05: £2,000\"\n", + " \"Value\": \"2015-06-05: 2,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(dividend_allowance_data, headers='keys', tablefmt='grid'))" + "df = pd.DataFrame(dividend_allowance_data)\n", + "df" ] }, { @@ -950,7 +856,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 31, "metadata": { "cellView": "form", "colab": { @@ -961,28 +867,63 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+-------------------------------------------------+-------------------+\n", - "| Name | Description | Value |\n", - "+====================+=================================================+===================+\n", - "| property_allowance | Amount of income from property untaxed per year | 2005-06-01: 1,000 |\n", - "+--------------------+-------------------------------------------------+-------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0property_allowance2005-06-01: 1,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 property_allowance 2005-06-01: 1,000 currency-GBP" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "property_allowance_data = [\n", " {\n", " \"Name\": \"property_allowance\",\n", - " \"Description\": \"Amount of income from property untaxed per year\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(property_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(property_allowance_data)\n", + "df\n" ] }, { @@ -996,7 +937,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 33, "metadata": { "cellView": "form", "colab": { @@ -1007,35 +948,69 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-------------------+-------------------------------------------+-------------------+\n", - "| Name | Description | Value |\n", - "+===================+===========================================+===================+\n", - "| trading_allowance | Amount of trading income untaxed per year | 2005-06-01: 1,000 |\n", - "+-------------------+-------------------------------------------+-------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0trading_allowance2005-06-01: 1,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 trading_allowance 2005-06-01: 1,000 currency-GBP" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "trading_allowance_data = [\n", " {\n", " \"Name\": \"trading_allowance\",\n", - " \"Description\": \"Amount of trading income untaxed per year\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(trading_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(trading_allowance_data)\n", + "df\n", + "\n" ] }, { "cell_type": "markdown", - "metadata": { - "id": "EsP8rEhFDppo" - }, + "metadata": {}, "source": [ "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." ] @@ -1050,7 +1025,15 @@ "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.9.7" } }, From f515120010ba33016c8ee4f721f1974c99501d1c Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 5 Oct 2023 04:52:13 -0400 Subject: [PATCH 07/20] revise doc --- docs/book/programs/gov/hmrc/income_tax.ipynb | 209 +++++++++---------- 1 file changed, 93 insertions(+), 116 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income_tax.ipynb b/docs/book/programs/gov/hmrc/income_tax.ipynb index 2c96020ff..eb80e445d 100644 --- a/docs/book/programs/gov/hmrc/income_tax.ipynb +++ b/docs/book/programs/gov/hmrc/income_tax.ipynb @@ -17,98 +17,17 @@ "source": [ "Income tax is a tax levied on the income earned by individuals and businesses. It is one of the primary sources of revenue for the UK government and is used to fund public services and government expenditures.\n", "\n", - "This table shows the core components of the UK income tax:\n" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "Gu96OiS8QwBu", - "outputId": "78f31024-25c7-44cd-c8fb-74f7ece243e2" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
CategoryDescription
0Tax AllowancesAmount of income an individual can earn before...
1Tax ChargesLiabilities imposed when certain conditions or...
2Tax RatesPercentage of income taken as tax. There are d...
3Tax ReliefsProvisions to reduce tax liability. Examples i...
\n", - "
" - ], - "text/plain": [ - " Category Description\n", - "0 Tax Allowances Amount of income an individual can earn before...\n", - "1 Tax Charges Liabilities imposed when certain conditions or...\n", - "2 Tax Rates Percentage of income taken as tax. There are d...\n", - "3 Tax Reliefs Provisions to reduce tax liability. Examples i..." - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import pandas as pd\n", + "- Tax Allowances:\n", + "These are specific amounts of income that individuals can earn before they are required to pay income tax. Various types of allowances exist, such as Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance, each offering different benefits and eligibility criteria.\n", "\n", - "headers = [\"Category\", \"Description\"]\n", - "data = [\n", - " [\"Tax Allowances\", \"Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance.\"],\n", - " [\"Tax Charges\", \"Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge.\"],\n", - " [\"Tax Rates\", \"Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates.\"],\n", - " [\"Tax Reliefs\", \"Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\"]\n", - "]\n", + "- Tax Charges:\n", + "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These liabilities ensure that individuals contribute a fair amount to the national revenue, with the charges varying depending on the level of income and other factors like the High-Income Child Benefit Charge.\n", "\n", - "df = pd.DataFrame(data, columns=headers)\n", - "df\n", - "\n" + "- Tax Rates:\n", + "The government applies different percentages of tax rates based on the income bracket an individual falls into. There are Basic, Higher, and Additional rates, each applicable to respective income ranges. Moreover, specific types of income, like dividends, have their distinct tax rates.\n", + "\n", + "- Tax Reliefs:\n", + "To promote certain behaviors or ease the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" ] }, { @@ -157,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 10, "metadata": { "cellView": "form", "colab": { @@ -168,27 +87,84 @@ }, "outputs": [ { - "ename": "ImportError", - "evalue": "cannot import name 'is_path' from 'PIL._util' (/Users/wangxi/opt/anaconda3/lib/python3.9/site-packages/PIL/_util.py)", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/var/folders/x2/71ydg8jd7b3bbw26tjh3df5c0000gn/T/ipykernel_12669/4239097814.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_uk\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mcalculate_income_tax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0memployment_income\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdividend_income\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m simulation = Simulation(\n\u001b[1;32m 5\u001b[0m situation={\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_uk/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_uk\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mentities\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m from policyengine_uk.system import (\n\u001b[1;32m 6\u001b[0m \u001b[0mCountryTaxBenefitSystem\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_uk/entities.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;31m# This file defines the entities needed by our legislation.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mentities\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mbuild_entity\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m State = build_entity(\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msimulations\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicrosimulation\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtaxbenefitsystems\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTaxBenefitSystem\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/simulations/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mtransform_to_strict_syntax\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m )\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mmicrosimulation\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicrosimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0msimulation\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulation\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0msimulation_builder\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mSimulationBuilder\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/policyengine_core/simulations/microsimulation.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mtyping\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDict\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mType\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmicrodf\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMicroDataFrame\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mMicroSeries\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpolicyengine_core\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdataset\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDataset\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/microdf/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0magg\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0magg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcombine_base_reform\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpctchg_base_reform\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mchart_utils\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdollar_format\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcurrency_format\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 3\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mcharts\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mquantile_pct_chg_plot\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mconcat\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mconcat\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m from .constants import (\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/microdf/chart_utils.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mmpl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mdollar_format\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msuffix\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \"\"\"Dollar formatter for matplotlib.\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/__init__.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[0;31m# cbook must import matplotlib only within function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 160\u001b[0m \u001b[0;31m# definitions, so it is safe to import from it here.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 161\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_api\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_version\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_docstring\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrcsetup\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 162\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcbook\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msanitize_sequence\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 163\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_api\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mMatplotlibDeprecationWarning\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/rcsetup.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0m_api\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcbook\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcbook\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mls_mapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 27\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolors\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mColormap\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mis_color_like\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 28\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_fontconfig_pattern\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mparse_fontconfig_pattern\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_enums\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mJoinStyle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mCapStyle\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/matplotlib/colors.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 52\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mPIL\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 53\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mPIL\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPngImagePlugin\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPngInfo\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mmpl\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/PIL/PngImagePlugin.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0menum\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mIntEnum\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 41\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 42\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageChops\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageFile\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImagePalette\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mImageSequence\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 43\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_binary\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mi16be\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mi16\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_binary\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mi32be\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mi32\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/opt/anaconda3/lib/python3.9/site-packages/PIL/ImageFile.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 35\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mImage\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 36\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0m_util\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mis_path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 37\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[0mMAXBLOCK\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m65536\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mImportError\u001b[0m: cannot import name 'is_path' from 'PIL._util' (/Users/wangxi/opt/anaconda3/lib/python3.9/site-packages/PIL/_util.py)" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
PersonEmployment Income (£)Dividend Income (£)Income Tax (£)
0Person 1500001000010068.5
1Person 2600001500015657.0
2Person 3700002000021282.0
3Person 4800002500027907.0
4Person 5900003000036532.0
\n", + "
" + ], + "text/plain": [ + " Person Employment Income (£) Dividend Income (£) Income Tax (£)\n", + "0 Person 1 50000 10000 10068.5\n", + "1 Person 2 60000 15000 15657.0\n", + "2 Person 3 70000 20000 21282.0\n", + "3 Person 4 80000 25000 27907.0\n", + "4 Person 5 90000 30000 36532.0" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -205,12 +181,12 @@ " }\n", " }\n", " )\n", - " return simulation.calculate(\"income_tax\")\n", + " return simulation.calculate(\"income_tax\")[0] \n", "\n", "data = {\n", " \"Person\": [\"Person 1\", \"Person 2\", \"Person 3\", \"Person 4\", \"Person 5\"],\n", - " \"Employment Income (£)\": [80000, 50000, 60000, 90000, 75000],\n", - " \"Dividend Income (£)\": [20000, 15000, 10000, 25000, 20000],\n", + " \"Employment Income (£)\": [50000, 60000, 70000, 80000, 90000],\n", + " \"Dividend Income (£)\": [10000, 15000, 20000, 25000, 30000],\n", " \"Income Tax (£)\": []\n", "}\n", "\n", @@ -218,7 +194,8 @@ " data[\"Income Tax (£)\"].append(calculate_income_tax(emp_income, div_income))\n", "\n", "df = pd.DataFrame(data)\n", - "df\n" + "df\n", + "\n" ] }, { From 72d249325bb13ddffe09c39042a50ea12ad64396 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 5 Oct 2023 04:59:21 -0400 Subject: [PATCH 08/20] revise --- .../book/programs/gov/hmrc/{income_tax.ipynb => income-tax.ipynb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/book/programs/gov/hmrc/{income_tax.ipynb => income-tax.ipynb} (100%) diff --git a/docs/book/programs/gov/hmrc/income_tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb similarity index 100% rename from docs/book/programs/gov/hmrc/income_tax.ipynb rename to docs/book/programs/gov/hmrc/income-tax.ipynb From ced895f06b256aed681eceae7c3d8c7ac2be2e7f Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 5 Oct 2023 09:15:54 -0400 Subject: [PATCH 09/20] revise income tax doc --- docs/book/programs/gov/hmrc/income-tax.ipynb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index eb80e445d..a0c200d61 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -168,6 +168,8 @@ } ], "source": [ + "import pandas as pd\n", + "\n", "from policyengine_uk import Simulation\n", "\n", "def calculate_income_tax(employment_income, dividend_income):\n", From cae602933a4f859164e4f85944aefdf5091d1d87 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 5 Oct 2023 08:42:15 -0500 Subject: [PATCH 10/20] revise --- docs/book/programs/gov/hmrc/income-tax.ipynb | 1343 ++++++++---------- 1 file changed, 581 insertions(+), 762 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index 16416afc1..a0c200d61 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -17,19 +17,73 @@ "source": [ "Income tax is a tax levied on the income earned by individuals and businesses. It is one of the primary sources of revenue for the UK government and is used to fund public services and government expenditures.\n", "\n", - "This table shows the core components of the UK income tax:\n" + "- Tax Allowances:\n", + "These are specific amounts of income that individuals can earn before they are required to pay income tax. Various types of allowances exist, such as Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance, each offering different benefits and eligibility criteria.\n", + "\n", + "- Tax Charges:\n", + "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These liabilities ensure that individuals contribute a fair amount to the national revenue, with the charges varying depending on the level of income and other factors like the High-Income Child Benefit Charge.\n", + "\n", + "- Tax Rates:\n", + "The government applies different percentages of tax rates based on the income bracket an individual falls into. There are Basic, Higher, and Additional rates, each applicable to respective income ranges. Moreover, specific types of income, like dividends, have their distinct tax rates.\n", + "\n", + "- Tax Reliefs:\n", + "To promote certain behaviors or ease the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "ER87IhZtVPL6" + }, + "source": [ + "## Legislation" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "x9-zPzjkWT8k" + }, + "source": [ + "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC).\n", + "\n", + "- Income Tax Act 2007 (ITA 2007):\n", + "This is a central piece of legislation consolidating various statutes related to income tax in the UK. It comprehensively covers aspects such as the charge to tax, applicable rates, allowances, and reliefs, serving as a foundational reference for income tax matters.\n", + "\n", + "- Taxation of Chargeable Gains Act 1992 (TCGA 1992):\n", + "Though primarily focused on capital gains tax, this Act intersects significantly with income tax, particularly in the realm of taxation of gains. It provides detailed regulations on how gains should be taxed and calculated.\n", + "\n", + "- Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003):\n", + "ITEPA 2003 governs the rules related to the taxation of employment income, pension income, and social security income. It outlines the various categories and criteria for taxable earnings and pensions, ensuring a structured approach to taxation in these areas.\n", + "\n", + "- HMRC Manuals and Guidance:\n", + "Produced by HMRC, these comprehensive guides aim to help taxpayers in understanding and complying with the complex tax legislation. They provide practical insights and interpretations of the laws, offering clarity and assistance to both individuals and businesses in navigating the income tax landscape.\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "VaL6XOutgEU4" + }, + "source": [ + "## Methodology:\n", + "\n", + " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax.\n", + "\n", + "The following table shows a series of income tax simulations using the PolicyEngine UK model." ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 10, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, - "id": "Gu96OiS8QwBu", - "outputId": "78f31024-25c7-44cd-c8fb-74f7ece243e2" + "id": "05DNxvPwgSRF", + "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" }, "outputs": [ { @@ -53,201 +107,129 @@ " \n", " \n", " \n", - " Category\n", - " Description\n", + " Person\n", + " Employment Income (£)\n", + " Dividend Income (£)\n", + " Income Tax (£)\n", " \n", " \n", " \n", " \n", " 0\n", - " Tax Allowances\n", - " Amount of income an individual can earn before...\n", + " Person 1\n", + " 50000\n", + " 10000\n", + " 10068.5\n", " \n", " \n", " 1\n", - " Tax Charges\n", - " Liabilities imposed when certain conditions or...\n", + " Person 2\n", + " 60000\n", + " 15000\n", + " 15657.0\n", " \n", " \n", " 2\n", - " Tax Rates\n", - " Percentage of income taken as tax. There are d...\n", + " Person 3\n", + " 70000\n", + " 20000\n", + " 21282.0\n", " \n", " \n", " 3\n", - " Tax Reliefs\n", - " Provisions to reduce tax liability. Examples i...\n", + " Person 4\n", + " 80000\n", + " 25000\n", + " 27907.0\n", + " \n", + " \n", + " 4\n", + " Person 5\n", + " 90000\n", + " 30000\n", + " 36532.0\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Category Description\n", - "0 Tax Allowances Amount of income an individual can earn before...\n", - "1 Tax Charges Liabilities imposed when certain conditions or...\n", - "2 Tax Rates Percentage of income taken as tax. There are d...\n", - "3 Tax Reliefs Provisions to reduce tax liability. Examples i..." + " Person Employment Income (£) Dividend Income (£) Income Tax (£)\n", + "0 Person 1 50000 10000 10068.5\n", + "1 Person 2 60000 15000 15657.0\n", + "2 Person 3 70000 20000 21282.0\n", + "3 Person 4 80000 25000 27907.0\n", + "4 Person 5 90000 30000 36532.0" ] }, - "execution_count": 1, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# @title\n", "import pandas as pd\n", "\n", - "headers = [\"Category\", \"Description\"]\n", - "data = [\n", - " [\"Tax Allowances\", \"Amount of income an individual can earn before they start paying tax. Examples include Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance.\"],\n", - " [\"Tax Charges\", \"Liabilities imposed when certain conditions or thresholds are met. For example, charges apply when income exceeds the personal allowance or in cases like the High-Income Child Benefit Charge.\"],\n", - " [\"Tax Rates\", \"Percentage of income taken as tax. There are different rates like Basic, Higher, and Additional rates. Dividends have their own rates.\"],\n", - " [\"Tax Reliefs\", \"Provisions to reduce tax liability. Examples include reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\"]\n", - "]\n", + "from policyengine_uk import Simulation\n", "\n", - "df = pd.DataFrame(data, columns=headers)\n", - "df\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "ER87IhZtVPL6", - "tags": [ - "hide-input" - ] - }, - "source": [ - "# Legislation" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "x9-zPzjkWT8k" - }, - "source": [ - "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC). This table briefly introduce the legislation of UK income tax:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "vInPOnY7WERk", - "outputId": "ef4bed84-45a9-4577-aa5d-f6a3abb81c47" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Legislation | Description |\n", - "+==========================================================+=========================================================================================================================+\n", - "| Income Tax Act 2007 (ITA 2007) | Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Taxation of Chargeable Gains Act 1992 (TCGA 1992) | Primarily about capital gains tax but intersects with income tax on the taxation of gains. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003) | Rules on taxation of employment income, pension income, and social security income. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| HMRC Manuals and Guidance | Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Finance Acts | Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| Case Law | Court judgments shaping the interpretation and application of income tax legislation. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n", - "| International Agreements | Double taxation treaties with other countries impacting taxation of UK and foreign residents. |\n", - "+----------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+\n" - ] - } - ], - "source": [ - "# @title\n", - "headers = [\"Legislation\", \"Description\"]\n", - "data = [\n", - " [\"Income Tax Act 2007 (ITA 2007)\", \"Central legislation consolidating statutes related to income tax. Covers charge to tax, rates, allowances, and reliefs.\"],\n", - " [\"Taxation of Chargeable Gains Act 1992 (TCGA 1992)\", \"Primarily about capital gains tax but intersects with income tax on the taxation of gains.\"],\n", - " [\"Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003)\", \"Rules on taxation of employment income, pension income, and social security income.\"],\n", - " [\"HMRC Manuals and Guidance\", \"Guidance produced by HMRC to help taxpayers understand and comply with tax legislation. Provides practical insight.\"],\n", - " [\"Finance Acts\", \"Annual Acts updating tax rates, allowances, and new tax measures announced in the Budget.\"],\n", - " [\"Case Law\", \"Court judgments shaping the interpretation and application of income tax legislation.\"],\n", - " [\"International Agreements\", \"Double taxation treaties with other countries impacting taxation of UK and foreign residents.\"]\n", - "]\n", + "def calculate_income_tax(employment_income, dividend_income):\n", + " simulation = Simulation(\n", + " situation={\n", + " \"people\": {\n", + " \"person\": {\n", + " \"employment_income\": employment_income,\n", + " \"dividend_income\": dividend_income,\n", + " }\n", + " }\n", + " }\n", + " )\n", + " return simulation.calculate(\"income_tax\")[0] \n", + "\n", + "data = {\n", + " \"Person\": [\"Person 1\", \"Person 2\", \"Person 3\", \"Person 4\", \"Person 5\"],\n", + " \"Employment Income (£)\": [50000, 60000, 70000, 80000, 90000],\n", + " \"Dividend Income (£)\": [10000, 15000, 20000, 25000, 30000],\n", + " \"Income Tax (£)\": []\n", + "}\n", + "\n", + "for emp_income, div_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"]):\n", + " data[\"Income Tax (£)\"].append(calculate_income_tax(emp_income, div_income))\n", "\n", - "print(tabulate(data, headers=headers, tablefmt=\"grid\"))\n" + "df = pd.DataFrame(data)\n", + "df\n", + "\n" ] }, { "cell_type": "markdown", "metadata": { - "id": "VaL6XOutgEU4" + "id": "DDa7lp9W3QVe" }, "source": [ - "## Methodology\n", - "\n" + "## Appendix:\n", + "\n", + "The following tables display the parameter values for income tax allowance." ] }, { "cell_type": "markdown", "metadata": { - "id": "7PgyfkG2kE-_" + "id": "xtGj1Z9q60Fs" }, "source": [ - "- Tax Allowance:\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax allowances:" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " earned_income_tax<2022, (default)> = [19432.]\n", - " pays_scottish_income_tax<2022, (default)> = [0.]\n", - " earned_taxable_income<2022, (default)> = [67430.]\n", - " earned_taxable_income<2022, (default)> = [67430.]\n" - ] - } - ], - "source": [ - "from policyengine_uk import Simulation\n", - "\n", - "simulation = Simulation(\n", - " situation={\n", - " \"people\": {\n", - " \"person\": {\n", - " \"employment_income\": 80_000,\n", - " \"dividend_income\": 20_000,\n", - " }\n", - " }\n", - " }\n", - ")\n", - "simulation.trace = True\n", - "simulation.calculate(\"earned_income_tax\")\n", - "simulation.tracer.print_computation_log(max_depth=2)" + "- Annual Allowance:" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 17, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/" }, - "id": "05DNxvPwgSRF", - "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" + "id": "fSIiOJct5htX", + "outputId": "58536b69-9972-4e93-da3f-15643df20342" }, "outputs": [ { @@ -271,25 +253,34 @@ " \n", " \n", " \n", - " Variable Name\n", - " Label\n", - " Reference\n", + " Name\n", + " Value\n", " Unit\n", " \n", " \n", " \n", " \n", " 0\n", - " personal_allowance\n", - " Personal Allowance for the year\n", - " [Income Tax Act 2007 s. 35]\n", + " default\n", + " 2015-06-01: 40,000\n", " currency-GBP\n", " \n", " \n", " 1\n", - " blind_persons_allowance\n", - " Blind Person's Allowance for the year (not sim...\n", - " [Income Tax Act 2007 s. 38]\n", + " minimum\n", + " 2015-06-01: 4,000\n", + " currency-GBP\n", + " \n", + " \n", + " 2\n", + " reduction_rate\n", + " 2015-06-01: 0.5\n", + " marginal-rate\n", + " \n", + " \n", + " 3\n", + " taper\n", + " 2015-06-01: 240,000\n", " currency-GBP\n", " \n", " \n", @@ -297,490 +288,47 @@ "" ], "text/plain": [ - " Variable Name Label \\\n", - "0 personal_allowance Personal Allowance for the year \n", - "1 blind_persons_allowance Blind Person's Allowance for the year (not sim... \n", - "\n", - " Reference Unit \n", - "0 [Income Tax Act 2007 s. 35] currency-GBP \n", - "1 [Income Tax Act 2007 s. 38] currency-GBP " + " Name Value Unit\n", + "0 default 2015-06-01: 40,000 currency-GBP\n", + "1 minimum 2015-06-01: 4,000 currency-GBP\n", + "2 reduction_rate 2015-06-01: 0.5 marginal-rate\n", + "3 taper 2015-06-01: 240,000 currency-GBP" ] }, - "execution_count": 7, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# @title\n", - "from tabulate import tabulate\n", - "from policyengine_uk.system import system\n", - "\n", - "VARIABLES = [ \n", - " \"personal_allowance\",\n", - " \"blind_persons_allowance\",\n", - "]\n", - "\n", - "variable_data = [system.variables[variable] for variable in VARIABLES]\n", - "\n", - "variables = [\n", - " {\n", - " \"name\": variable.name,\n", - " \"label\": variable.label,\n", - " \"reference\": variable.reference,\n", - " \"unit\": variable.unit\n", - " }\n", - " for variable in variable_data\n", - "]\n", - "\"\"\"\n", - "variables = [\n", - " {\n", - " \"name\": \"personal_allowance\",\n", - " \"label\": \"Personal Allowance for the year\",\n", - " \"reference\": \"Income Tax Act 2007 s. 35\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"blind_persons_allowance\",\n", - " \"label\": \"Blind Person's Allowance for the year (not simulated)\",\n", - " \"reference\": \"Income Tax Act 2007 s. 38\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"trading_allowance\",\n", - " \"label\": \"Trading Allowance for the year\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"trading_allowance_deduction\",\n", - " \"label\": \"Deduction applied by the trading allowance\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783AF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"property_allowance\",\n", - " \"label\": \"Property Allowance for the year\",\n", - " \"reference\": \"Income Tax (Trading and Other Income) Act 2005 s. 783BF\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"savings_allowance\",\n", - " \"label\": \"Savings Allowance for the year\",\n", - " \"reference\": \"Income Tax Act 2007 s. 12B\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"dividend_allowance\",\n", - " \"label\": \"Dividend allowance for the person\",\n", - " \"reference\": \"Income Tax Act 2007 s. 13A\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"name\": \"meets_marriage_allowance_income_conditions\",\n", - " \"label\": \"Meets Marriage Allowance income conditions\",\n", - " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/section/55B\",\n", - " \"unit\": \"\"\n", - " },\n", - " {\n", - " \"name\": \"marriage_allowance\",\n", - " \"label\": \"Marriage Allowance\",\n", - " \"reference\": \"https://www.legislation.gov.uk/ukpga/2007/3/part/3/chapter/3A\",\n", - " \"unit\": \"GBP\"\n", - " },\n", - "]\"\"\"\n", - "\n", - "headers = [\"Variable Name\", \"Label\", \"Reference\", \"Unit\"]\n", - "table_data = [(v[\"name\"], v[\"label\"], v[\"reference\"], v[\"unit\"]) for v in variables]\n", - "import pandas as pd\n", - "\n", - "table = pd.DataFrame(table_data, columns=headers)\n", - "table\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "c0h8F-sRkybB" - }, - "source": [ - "- Tax Charges:\\\n", - "This table introduces the CB HITC methodology used by PolicyEngine UK to model tax charges.\n" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "HFWPFr1qlrg6", - "outputId": "ae42e976-bec9-4f8b-cd72-45bdc2429f86" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-------------+-------------------------------------------------------------------------+\n", - "| Component | Description |\n", - "+=============+=========================================================================+\n", - "| Entity | Person |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Value Type | Float |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Unit | GBP |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Period | YEAR |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Reference | https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8 |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Defined For | Higher Earner |\n", - "+-------------+-------------------------------------------------------------------------+\n", - "| Calculation | 1. Determine Child Benefit received. |\n", - "| | 2. Fetch CB HITC parameters. |\n", - "| | 3. Calculate % of CB to be recollected based on adjusted net income. |\n", - "| | 4. Return the lesser of the calculated % of CB or the full CB received. |\n", - "+-------------+-------------------------------------------------------------------------+\n" - ] - } - ], - "source": [ - "# @title\n", - "headers = ['Component', 'Description']\n", - "data = [\n", - " ['Entity', 'Person'],\n", - " ['Value Type', 'Float'],\n", - " ['Unit', 'GBP'],\n", - " ['Period', 'YEAR'],\n", - " ['Reference', 'https://www.legislation.gov.uk/ukpga/2003/1/part/10/chapter/8'],\n", - " ['Defined For', 'Higher Earner'],\n", - " ['Calculation', (\n", - " \"1. Determine Child Benefit received.\\n\"\n", - " \"2. Fetch CB HITC parameters.\\n\"\n", - " \"3. Calculate % of CB to be recollected based on adjusted net income.\\n\"\n", - " \"4. Return the lesser of the calculated % of CB or the full CB received.\"\n", - " )]\n", - "]\n", - "\n", - "print(tabulate(data, headers=headers, tablefmt='grid'))\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "ugj-zQp1myCB" - }, - "source": [ - "- Base:\\\n", - "This table introduces the two classes (total_pension_income and social_security_income) used by PolicyEngine UK to model income tax." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "PaqUIN6gtBQ5", - "outputId": "b0e20a52-2b2f-43f3-f6f8-36af95733da0" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| Variable Name | Label | Description/Components | Reference | Unit |\n", - "+========================+==============================================+===============================================================================+========================================================+========+\n", - "| total_pension_income | Total pension income | Private, personal and State Pension income | Income Tax Act 2007 s. 23 | GBP |\n", - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| social_security_income | Income from social security for tax purposes | state_pension, incapacity_benefit, JSA_contrib, ESA_contrib, carers_allowance | Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b) | GBP |\n", - "+------------------------+----------------------------------------------+-------------------------------------------------------------------------------+--------------------------------------------------------+--------+\n" - ] - } - ], - "source": [ - "# @title\n", - "data = [\n", - " [\"Variable Name\", \"Label\", \"Description/Components\", \"Reference\", \"Unit\"],\n", - " [\"total_pension_income\",\n", - " \"Total pension income\",\n", - " \"Private, personal and State Pension income\",\n", - " \"Income Tax Act 2007 s. 23\",\n", - " \"GBP\"],\n", - " [\"social_security_income\",\n", - " \"Income from social security for tax purposes\",\n", - " \", \".join([\"state_pension\", \"incapacity_benefit\", \"JSA_contrib\", \"ESA_contrib\", \"carers_allowance\"]),\n", - " \"Income Tax (Earnings and Pensions) Act 2003 s. 1(1)(b)\",\n", - " \"GBP\"]\n", - "]\n", - "\n", - "table = tabulate(data, headers='firstrow', tablefmt='grid')\n", - "print(table)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "4Uw4aVRZtOW7" - }, - "source": [ - "- Liability\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax liability:" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "pskzpAi1ueD5", - "outputId": "6b5b35d4-1053-4992-a3c0-fdd84b963885" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+=============================+=========================================================+=============================================+===========+\n", - "| earned_taxable_income | Non-savings, non-dividend income for Income Tax | Income Tax Act 2007 s. 10 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| earned_income_tax | Income tax on earned income | Income Tax Act 2007 s. 11 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| savings_starter_rate_income | Savings income which is tax-free under the starter rate | Income Tax Act 2007 s. 13 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| pension_annuity_income | Income from pensions and annuities | Pensions Act 2015 s. 14 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| property_rental_income | Income from renting out properties | Housing Act 1988 s. 4 | USD/month |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| dividend_income | Income from dividends | Companies Act 2006 s. 801 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n", - "| capital_gains_income | Income from capital gains | Taxation of Chargeable Gains Act 1992 s. 20 | USD |\n", - "+-----------------------------+---------------------------------------------------------+---------------------------------------------+-----------+\n" - ] - } - ], - "source": [ - "# @title\n", - "variables_data = [\n", - " {\n", - " \"Variable Name\": \"earned_taxable_income\",\n", - " \"Label\": \"Non-savings, non-dividend income for Income Tax\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 10\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"earned_income_tax\",\n", - " \"Label\": \"Income tax on earned income\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 11\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"savings_starter_rate_income\",\n", - " \"Label\": \"Savings income which is tax-free under the starter rate\",\n", - " \"Reference\": \"Income Tax Act 2007 s. 13\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"pension_annuity_income\",\n", - " \"Label\": \"Income from pensions and annuities\",\n", - " \"Reference\": \"Pensions Act 2015 s. 14\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"property_rental_income\",\n", - " \"Label\": \"Income from renting out properties\",\n", - " \"Reference\": \"Housing Act 1988 s. 4\",\n", - " \"Unit\": \"USD/month\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"dividend_income\",\n", - " \"Label\": \"Income from dividends\",\n", - " \"Reference\": \"Companies Act 2006 s. 801\",\n", - " \"Unit\": \"USD\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"capital_gains_income\",\n", - " \"Label\": \"Income from capital gains\",\n", - " \"Reference\": \"Taxation of Chargeable Gains Act 1992 s. 20\",\n", - " \"Unit\": \"USD\"\n", - " }\n", - "]\n", - "\n", - "table = tabulate(variables_data, headers='keys', tablefmt=\"grid\")\n", - "\n", - "print(table)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "UUyN4ehR0zu6" - }, - "source": [ - "- Tax Relief\\\n", - "This table shows some of variables used by PolicyEngine UK to model income tax relief:\n" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "KIwtvd6k2BBH", - "outputId": "50587fbd-7be1-49bd-a6c1-d42cd01edd1b" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| Variable Name | Label | Reference | Unit |\n", - "+=================================+====================================================================+========================================================+========+\n", - "| taxable_employment_income | Net taxable earnings | Income Tax (Earnings and Pensions) Act 2003 s. 11 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| employment_deductions | Deductions from employment income | Income Tax Act (Earnings and Pensions) Act 2003 s. 327 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| employment_expenses | Cost of expenses necessarily incurred and reimbursed by employment | Income Tax Act (Earnings and Pensions) Act 2003 s. 333 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| taxable_savings_interest_income | Amount of savings interest which is taxable | Income Tax Act (Trading and Other Income) 2005 s. 369 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n", - "| taxable_pension_income | Amount of pension income that is taxable | Income Tax (Earnings and Pensions) Act 2003 s. 567 | GBP |\n", - "+---------------------------------+--------------------------------------------------------------------+--------------------------------------------------------+--------+\n" - ] - } - ], - "source": [ - "# @title\n", - "selected_variables_data = [\n", - " {\n", - " \"Variable Name\": \"taxable_employment_income\",\n", - " \"Label\": \"Net taxable earnings\",\n", - " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 11\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"employment_deductions\",\n", - " \"Label\": \"Deductions from employment income\",\n", - " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 327\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"employment_expenses\",\n", - " \"Label\": \"Cost of expenses necessarily incurred and reimbursed by employment\",\n", - " \"Reference\": \"Income Tax Act (Earnings and Pensions) Act 2003 s. 333\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"taxable_savings_interest_income\",\n", - " \"Label\": \"Amount of savings interest which is taxable\",\n", - " \"Reference\": \"Income Tax Act (Trading and Other Income) 2005 s. 369\",\n", - " \"Unit\": \"GBP\"\n", - " },\n", - " {\n", - " \"Variable Name\": \"taxable_pension_income\",\n", - " \"Label\": \"Amount of pension income that is taxable\",\n", - " \"Reference\": \"Income Tax (Earnings and Pensions) Act 2003 s. 567\",\n", - " \"Unit\": \"GBP\"\n", - " }\n", - "]\n", - "\n", - "table = tabulate(selected_variables_data, headers='keys', tablefmt=\"grid\")\n", - "\n", - "print(table)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "DDa7lp9W3QVe" - }, - "source": [ - "# Appendix:\n", - "\n", - "The following tables and plot display the parameter values for income tax allowance." - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "xtGj1Z9q60Fs" - }, - "source": [ - "- Annual Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "fSIiOJct5htX", - "outputId": "58536b69-9972-4e93-da3f-15643df20342" - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| Name | Description | Value |\n", - "+================+================================================================+=====================+\n", - "| default | Annual allowance for relief on pension contributions | 2015-06-01: 40,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| minimum | Minimum annual allowance for relief on pension contributions | 2015-06-01: 4,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| reduction_rate | Reduction rate for the annual allowance | 2015-06-01: 0.5 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n", - "| taper | Adjusted net income limit for tapering of the annual allowance | 2015-06-01: 240,000 |\n", - "+----------------+----------------------------------------------------------------+---------------------+\n" - ] - } - ], - "source": [ - "# @title\n", "annual_allowance_data = [\n", " {\n", " \"Name\": \"default\",\n", - " \"Description\": \"Annual allowance for relief on pension contributions\",\n", - " \"Value\": \"2015-06-01: 40,000\"\n", + " \"Value\": \"2015-06-01: 40,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", + "\n", " {\n", " \"Name\": \"minimum\",\n", - " \"Description\": \"Minimum annual allowance for relief on pension contributions\",\n", - " \"Value\": \"2015-06-01: 4,000\"\n", + " \"Value\": \"2015-06-01: 4,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", + "\n", " {\n", " \"Name\": \"reduction_rate\",\n", - " \"Description\": \"Reduction rate for the annual allowance\",\n", - " \"Value\": \"2015-06-01: 0.5\"\n", + " \"Value\": \"2015-06-01: 0.5\",\n", + " \"Unit\": \"marginal-rate\"\n", + "\n", " },\n", " {\n", " \"Name\": \"taper\",\n", - " \"Description\": \"Adjusted net income limit for tapering of the annual allowance\",\n", - " \"Value\": \"2015-06-01: 240,000\"\n", + " \"Value\": \"2015-06-01: 240,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(annual_allowance_data, headers='keys', tablefmt='grid'))\n", - "\n" + "df = pd.DataFrame(annual_allowance_data)\n", + "df\n" ] }, { @@ -794,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 20, "metadata": { "cellView": "form", "colab": { @@ -805,43 +353,88 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| Name | Description | Value |\n", - "+====================+=====================================================================================================+==================+\n", - "| max | Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance | 2016-04-01: 10% |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| rounding_increment | The Marriage Allowance is rounded up by this increment. | 2016-04-01: 10 |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n", - "| takeup_rate | Percentage of eligible couples who claim Marriage Allowance. | 2000-01-01: 100% |\n", - "+--------------------+-----------------------------------------------------------------------------------------------------+------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0max2016-04-01: 0.1/1
1rounding_increment2016-04-01: 10currency-GBP
2takeup_rate2000-01-01: 1/1
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 max 2016-04-01: 0.1 /1\n", + "1 rounding_increment 2016-04-01: 10 currency-GBP\n", + "2 takeup_rate 2000-01-01: 1 /1" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "marriage_allowance_data = [\n", " {\n", " \"Name\": \"max\",\n", - " \"Description\": \"Maximum Marriage Allowance taxable income reduction, as a percentage of the full Personal Allowance\",\n", - " \"Value\": \"2016-04-01: 10%\"\n", + " \"Value\": \"2016-04-01: 0.1\",\n", + " \"Unit\": \"/1\"\n", " },\n", " {\n", " \"Name\": \"rounding_increment\",\n", - " \"Description\": \"The Marriage Allowance is rounded up by this increment.\",\n", - " \"Value\": \"2016-04-01: 10\"\n", + " \"Value\": \"2016-04-01: 10\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", " \"Name\": \"takeup_rate\",\n", - " \"Description\": \"Percentage of eligible couples who claim Marriage Allowance.\",\n", - " \"Value\": \"2000-01-01: 100%\",\n", + " \"Value\": \"2000-01-01: 1\",\n", + " \"Unit\": \"/1\"\n", " }\n", "]\n", "\n", - "# Draw table using tabulate\n", - "print(tabulate(marriage_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(marriage_allowance_data)\n", + "df\n", + "\n" ] }, { @@ -855,7 +448,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 25, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -865,28 +458,64 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n", - "| Name | Description | Value |\n", - "+================+============================================================================================+=================+\n", - "| deduction_rate | Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability | 2010-01-01: 10% |\n", - "+----------------+--------------------------------------------------------------------------------------------+-----------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0deduction_rate2010-01-01: 10%/1
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 deduction_rate 2010-01-01: 10% /1" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "married_couples_allowance_data = [\n", " {\n", " \"Name\": \"deduction_rate\",\n", - " \"Description\": \"Percentage of the Married Couple's Allowance which is deductible from Income Tax Liability\",\n", - " \"Value\": \"2010-01-01: 10%\"\n", + " \"Value\": \"2010-01-01: 10%\",\n", + " \"Unit\": \"/1\"\n", " }\n", "]\n", "\n", - "print(tabulate(married_couples_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(married_couples_allowance_data)\n", + "df\n", + "\n" ] }, { @@ -900,7 +529,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 28, "metadata": { "cellView": "form", "colab": { @@ -914,58 +543,97 @@ { "data": { "text/html": [ - "\n", - "\n", - "\n", - "
\n", - "
\n", - "\n", - "" + " .dataframe thead th {\n", + " text-align: right;\n", + " }\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
DateAllowance AmountUnit
02015-04-0610600currency-GBP
12017-04-0611500currency-GBP
22018-04-0611850currency-GBP
32019-04-0612500currency-GBP
42021-04-0612570currency-GBP
52025-04-0612570currency-GBP
\n", + "" + ], + "text/plain": [ + " Date Allowance Amount Unit\n", + "0 2015-04-06 10600 currency-GBP\n", + "1 2017-04-06 11500 currency-GBP\n", + "2 2018-04-06 11850 currency-GBP\n", + "3 2019-04-06 12500 currency-GBP\n", + "4 2021-04-06 12570 currency-GBP\n", + "5 2025-04-06 12570 currency-GBP" ] }, + "execution_count": 28, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ - "# @title\n", - "import plotly.express as px\n", - "import pandas as pd\n", - "\n", "dates = ['2015-04-06', '2017-04-06', '2018-04-06', '2019-04-06', '2021-04-06', '2025-04-06']\n", "values = [10600, 11500, 11850, 12500, 12570, 12570]\n", "\n", "df = pd.DataFrame({\n", " 'Date': dates,\n", - " 'Allowance Amount': values\n", + " 'Allowance Amount': values,\n", + " 'Unit': \"currency-GBP\"\n", "})\n", "\n", - "fig = px.line(df, x='Date', y='Allowance Amount', title='Personal Allowance Over Time', markers=True)\n", - "fig.show()\n" + "df\n", + "\n" ] }, { @@ -979,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 29, "metadata": { "cellView": "form", "colab": { @@ -990,42 +658,89 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+------------+-----------------------------------------------+--------------------+\n", - "| Name | Description | Value |\n", - "+============+===============================================+====================+\n", - "| additional | Savings allowance in the additional threshold | 2005-06-01: £0 |\n", - "+------------+-----------------------------------------------+--------------------+\n", - "| basic | Savings allowance in the basic threshold | 2005-06-01: £1,000 |\n", - "+------------+-----------------------------------------------+--------------------+\n", - "| higher | Savings allowance in the higher threshold | 2005-06-01: £500 |\n", - "+------------+-----------------------------------------------+--------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0additional threshold2005-06-01: 0currency-GBP
1basic threshold2005-06-01: 1,000currency-GBP
2higher threshold2005-06-01: 500currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 additional threshold 2005-06-01: 0 currency-GBP\n", + "1 basic threshold 2005-06-01: 1,000 currency-GBP\n", + "2 higher threshold 2005-06-01: 500 currency-GBP" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "personal_savings_allowance_data = [\n", " {\n", - " \"Name\": \"additional\",\n", - " \"Description\": \"Savings allowance in the additional threshold\",\n", - " \"Value\": \"2005-06-01: 0\"\n", + " \"Name\": \"additional threshold\",\n", + " \"Value\": \"2005-06-01: 0\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", - " \"Name\": \"basic\",\n", - " \"Description\": \"Savings allowance in the basic threshold\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Name\": \"basic threshold\",\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " },\n", " {\n", - " \"Name\": \"higher\",\n", - " \"Description\": \"Savings allowance in the higher threshold\",\n", - " \"Value\": \"2005-06-01: 500\"\n", + " \"Name\": \"higher threshold\",\n", + " \"Value\": \"2005-06-01: 500\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(personal_savings_allowance_data, headers='keys', tablefmt='grid'))" + "df = pd.DataFrame(personal_savings_allowance_data)\n", + "df\n", + "\n", + "\n" ] }, { @@ -1039,7 +754,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 30, "metadata": { "cellView": "form", "colab": { @@ -1050,28 +765,63 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+--------------------------------------------+--------------------+\n", - "| Name | Description | Value |\n", - "+====================+============================================+====================+\n", - "| dividend_allowance | Amount of dividend income untaxed per year | 2015-06-05: £2,000 |\n", - "+--------------------+--------------------------------------------+--------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0dividend_allowance2015-06-05: 2,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 dividend_allowance 2015-06-05: 2,000 currency-GBP" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "dividend_allowance_data = [\n", " {\n", " \"Name\": \"dividend_allowance\",\n", - " \"Description\": \"Amount of dividend income untaxed per year\",\n", - " \"Value\": \"2015-06-05: £2,000\"\n", + " \"Value\": \"2015-06-05: 2,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(dividend_allowance_data, headers='keys', tablefmt='grid'))" + "df = pd.DataFrame(dividend_allowance_data)\n", + "df" ] }, { @@ -1085,7 +835,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 31, "metadata": { "cellView": "form", "colab": { @@ -1096,28 +846,63 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+--------------------+-------------------------------------------------+-------------------+\n", - "| Name | Description | Value |\n", - "+====================+=================================================+===================+\n", - "| property_allowance | Amount of income from property untaxed per year | 2005-06-01: 1,000 |\n", - "+--------------------+-------------------------------------------------+-------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0property_allowance2005-06-01: 1,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 property_allowance 2005-06-01: 1,000 currency-GBP" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "property_allowance_data = [\n", " {\n", " \"Name\": \"property_allowance\",\n", - " \"Description\": \"Amount of income from property untaxed per year\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(property_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(property_allowance_data)\n", + "df\n" ] }, { @@ -1131,7 +916,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 33, "metadata": { "cellView": "form", "colab": { @@ -1142,35 +927,69 @@ }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "+-------------------+-------------------------------------------+-------------------+\n", - "| Name | Description | Value |\n", - "+===================+===========================================+===================+\n", - "| trading_allowance | Amount of trading income untaxed per year | 2005-06-01: 1,000 |\n", - "+-------------------+-------------------------------------------+-------------------+\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
NameValueUnit
0trading_allowance2005-06-01: 1,000currency-GBP
\n", + "
" + ], + "text/plain": [ + " Name Value Unit\n", + "0 trading_allowance 2005-06-01: 1,000 currency-GBP" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "# @title\n", "trading_allowance_data = [\n", " {\n", " \"Name\": \"trading_allowance\",\n", - " \"Description\": \"Amount of trading income untaxed per year\",\n", - " \"Value\": \"2005-06-01: 1,000\"\n", + " \"Value\": \"2005-06-01: 1,000\",\n", + " \"Unit\": \"currency-GBP\"\n", " }\n", "]\n", "\n", - "print(tabulate(trading_allowance_data, headers='keys', tablefmt='grid'))\n" + "df = pd.DataFrame(trading_allowance_data)\n", + "df\n", + "\n" ] }, { "cell_type": "markdown", - "metadata": { - "id": "EsP8rEhFDppo" - }, + "metadata": {}, "source": [ "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." ] @@ -1194,7 +1013,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.9.7" } }, "nbformat": 4, From 0800ec3498eb01097cfb52201e2de56acf2cf7f1 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 12 Oct 2023 08:35:23 -0400 Subject: [PATCH 11/20] revise --- docs/book/programs/gov/hmrc/income-tax.ipynb | 5551 +++++++++++++++++- 1 file changed, 5291 insertions(+), 260 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index a0c200d61..a5a5be3ec 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -21,13 +21,13 @@ "These are specific amounts of income that individuals can earn before they are required to pay income tax. Various types of allowances exist, such as Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance, each offering different benefits and eligibility criteria.\n", "\n", "- Tax Charges:\n", - "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These liabilities ensure that individuals contribute a fair amount to the national revenue, with the charges varying depending on the level of income and other factors like the High-Income Child Benefit Charge.\n", + "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These charges fluctuate based on income levels and are influenced by additional factors, such as the High-Income Child Benefit Charge.\n", "\n", "- Tax Rates:\n", "The government applies different percentages of tax rates based on the income bracket an individual falls into. There are Basic, Higher, and Additional rates, each applicable to respective income ranges. Moreover, specific types of income, like dividends, have their distinct tax rates.\n", "\n", "- Tax Reliefs:\n", - "To promote certain behaviors or ease the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" + "To promote certain behaviors or lower the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" ] }, { @@ -76,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": { "cellView": "form", "colab": { @@ -110,94 +110,135 @@ " Person\n", " Employment Income (£)\n", " Dividend Income (£)\n", + " Savings Interest Income (£)\n", " Income Tax (£)\n", + " Dividend Income Tax (£)\n", + " Savings Income Tax (£)\n", " \n", " \n", " \n", " \n", " 0\n", - " Person 1\n", + " Person1\n", " 50000\n", " 10000\n", + " 5000\n", " 10068.5\n", + " 2582.5\n", + " 0.0\n", " \n", " \n", " 1\n", - " Person 2\n", + " Person2\n", " 60000\n", " 15000\n", - " 15657.0\n", + " 10000\n", + " 17457.0\n", + " 4225.0\n", + " 1800.0\n", " \n", " \n", " 2\n", - " Person 3\n", + " Person3\n", " 70000\n", " 20000\n", - " 21282.0\n", + " 15000\n", + " 26082.0\n", + " 5850.0\n", + " 3800.0\n", " \n", " \n", " 3\n", - " Person 4\n", + " Person4\n", " 80000\n", " 25000\n", - " 27907.0\n", + " 20000\n", + " 37707.0\n", + " 7475.0\n", + " 5800.0\n", " \n", " \n", " 4\n", - " Person 5\n", + " Person5\n", " 90000\n", " 30000\n", - " 36532.0\n", + " 25000\n", + " 45360.0\n", + " 9100.0\n", + " 7800.0\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Person Employment Income (£) Dividend Income (£) Income Tax (£)\n", - "0 Person 1 50000 10000 10068.5\n", - "1 Person 2 60000 15000 15657.0\n", - "2 Person 3 70000 20000 21282.0\n", - "3 Person 4 80000 25000 27907.0\n", - "4 Person 5 90000 30000 36532.0" + " Person Employment Income (£) Dividend Income (£) \\\n", + "0 Person1 50000 10000 \n", + "1 Person2 60000 15000 \n", + "2 Person3 70000 20000 \n", + "3 Person4 80000 25000 \n", + "4 Person5 90000 30000 \n", + "\n", + " Savings Interest Income (£) Income Tax (£) Dividend Income Tax (£) \\\n", + "0 5000 10068.5 2582.5 \n", + "1 10000 17457.0 4225.0 \n", + "2 15000 26082.0 5850.0 \n", + "3 20000 37707.0 7475.0 \n", + "4 25000 45360.0 9100.0 \n", + "\n", + " Savings Income Tax (£) \n", + "0 0.0 \n", + "1 1800.0 \n", + "2 3800.0 \n", + "3 5800.0 \n", + "4 7800.0 " ] }, - "execution_count": 10, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", - "\n", "from policyengine_uk import Simulation\n", "\n", - "def calculate_income_tax(employment_income, dividend_income):\n", + "def calculate_taxes(employment_income, dividend_income, savings_interest_income):\n", " simulation = Simulation(\n", " situation={\n", " \"people\": {\n", " \"person\": {\n", " \"employment_income\": employment_income,\n", " \"dividend_income\": dividend_income,\n", + " \"savings_interest_income\": savings_interest_income\n", " }\n", " }\n", " }\n", " )\n", - " return simulation.calculate(\"income_tax\")[0] \n", + " income_tax = simulation.calculate(\"income_tax\")[0]\n", + " dividend_income_tax = simulation.calculate(\"dividend_income_tax\")[0] # Added\n", + " savings_income_tax = simulation.calculate(\"savings_income_tax\")[0] # Added\n", + " \n", + " return income_tax, dividend_income_tax, savings_income_tax\n", "\n", "data = {\n", - " \"Person\": [\"Person 1\", \"Person 2\", \"Person 3\", \"Person 4\", \"Person 5\"],\n", + " \"Person\": [\"Person1\", \"Person2\", \"Person3\", \"Person4\", \"Person5\"],\n", " \"Employment Income (£)\": [50000, 60000, 70000, 80000, 90000],\n", " \"Dividend Income (£)\": [10000, 15000, 20000, 25000, 30000],\n", - " \"Income Tax (£)\": []\n", + " \"Savings Interest Income (£)\": [5000, 10000, 15000, 20000, 25000],\n", + " \"Income Tax (£)\": [],\n", + " \"Dividend Income Tax (£)\": [],\n", + " \"Savings Income Tax (£)\": []\n", "}\n", "\n", - "for emp_income, div_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"]):\n", - " data[\"Income Tax (£)\"].append(calculate_income_tax(emp_income, div_income))\n", + "for emp_income, div_income, sav_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"], data[\"Savings Interest Income (£)\"]):\n", + " income_tax, div_tax, sav_tax = calculate_taxes(emp_income, div_income, sav_income)\n", + " data[\"Income Tax (£)\"].append(income_tax)\n", + " data[\"Dividend Income Tax (£)\"].append(div_tax)\n", + " data[\"Savings Income Tax (£)\"].append(sav_tax)\n", "\n", "df = pd.DataFrame(data)\n", - "df\n", - "\n" + "df" ] }, { @@ -222,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 68, "metadata": { "cellView": "form", "colab": { @@ -253,82 +294,80 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " default\n", - " 2015-06-01: 40,000\n", - " currency-GBP\n", + " Default\n", + " 40000.0\n", + " 2015-06-01\n", " \n", " \n", " 1\n", - " minimum\n", - " 2015-06-01: 4,000\n", - " currency-GBP\n", + " Minimum\n", + " 4000.0\n", + " 2015-06-01\n", " \n", " \n", " 2\n", - " reduction_rate\n", - " 2015-06-01: 0.5\n", - " marginal-rate\n", + " Reduction Rate\n", + " 0.5\n", + " 2015-06-01\n", " \n", " \n", " 3\n", - " taper\n", - " 2015-06-01: 240,000\n", - " currency-GBP\n", + " Taper\n", + " 240000.0\n", + " 2015-06-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 default 2015-06-01: 40,000 currency-GBP\n", - "1 minimum 2015-06-01: 4,000 currency-GBP\n", - "2 reduction_rate 2015-06-01: 0.5 marginal-rate\n", - "3 taper 2015-06-01: 240,000 currency-GBP" + " Type Value Effective Date\n", + "0 Default 40000.0 2015-06-01\n", + "1 Minimum 4000.0 2015-06-01\n", + "2 Reduction Rate 0.5 2015-06-01\n", + "3 Taper 240000.0 2015-06-01" ] }, - "execution_count": 17, + "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "annual_allowance_data = [\n", - " {\n", - " \"Name\": \"default\",\n", - " \"Value\": \"2015-06-01: 40,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", + "from policyengine_uk.system import system\n", + "import pandas as pd\n", "\n", - " {\n", - " \"Name\": \"minimum\",\n", - " \"Value\": \"2015-06-01: 4,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", + "default = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.default\n", + "minimum = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.minimum\n", + "reduction_rate = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.reduction_rate\n", + "taper = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.taper\n", "\n", - " {\n", - " \"Name\": \"reduction_rate\",\n", - " \"Value\": \"2015-06-01: 0.5\",\n", - " \"Unit\": \"marginal-rate\"\n", + "data = {\n", + " \"Type\": [\"Default\", \"Minimum\", \"Reduction Rate\", \"Taper\"],\n", + " \"Value\": [\n", + " default.values_list[-1].value,\n", + " minimum.values_list[-1].value,\n", + " reduction_rate.values_list[-1].value,\n", + " taper.values_list[-1].value,\n", + " ],\n", + " \"Effective Date\": [\n", + " default.values_list[-1].instant_str,\n", + " minimum.values_list[-1].instant_str,\n", + " reduction_rate.values_list[-1].instant_str,\n", + " taper.values_list[-1].instant_str,\n", + " ]\n", + "}\n", "\n", - " },\n", - " {\n", - " \"Name\": \"taper\",\n", - " \"Value\": \"2015-06-01: 240,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(annual_allowance_data)\n", - "df\n" + "df = pd.DataFrame(data)\n", + "df" ] }, { @@ -342,7 +381,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 69, "metadata": { "cellView": "form", "colab": { @@ -373,68 +412,66 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " max\n", - " 2016-04-01: 0.1\n", - " /1\n", + " Max\n", + " 0.1\n", + " 2016-04-01\n", " \n", " \n", " 1\n", - " rounding_increment\n", - " 2016-04-01: 10\n", - " currency-GBP\n", + " Rounding Increment\n", + " 10.0\n", + " 2016-04-01\n", " \n", " \n", " 2\n", - " takeup_rate\n", - " 2000-01-01: 1\n", - " /1\n", + " Takeup Rate\n", + " 1.0\n", + " 2000-01-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 max 2016-04-01: 0.1 /1\n", - "1 rounding_increment 2016-04-01: 10 currency-GBP\n", - "2 takeup_rate 2000-01-01: 1 /1" + " Type Value Effective Date\n", + "0 Max 0.1 2016-04-01\n", + "1 Rounding Increment 10.0 2016-04-01\n", + "2 Takeup Rate 1.0 2000-01-01" ] }, - "execution_count": 20, + "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "marriage_allowance_data = [\n", - " {\n", - " \"Name\": \"max\",\n", - " \"Value\": \"2016-04-01: 0.1\",\n", - " \"Unit\": \"/1\"\n", - " },\n", - " {\n", - " \"Name\": \"rounding_increment\",\n", - " \"Value\": \"2016-04-01: 10\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"takeup_rate\",\n", - " \"Value\": \"2000-01-01: 1\",\n", - " \"Unit\": \"/1\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(marriage_allowance_data)\n", - "df\n", - "\n" + "max = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.max\n", + "rounding_increment = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", + "takeup_rate = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.takeup_rate\n", + "\n", + "data = {\n", + " \"Type\": [\"Max\", \"Rounding Increment\", \"Takeup Rate\"],\n", + " \"Value\": [\n", + " max.values_list[-1].value,\n", + " rounding_increment.values_list[-1].value,\n", + " takeup_rate.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " max.values_list[-1].instant_str,\n", + " rounding_increment.values_list[-1].instant_str,\n", + " takeup_rate.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "df" ] }, { @@ -448,7 +485,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 70, "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -478,42 +515,45 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " deduction_rate\n", - " 2010-01-01: 10%\n", - " /1\n", + " Deduction Rate\n", + " 0.1\n", + " 2010-01-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 deduction_rate 2010-01-01: 10% /1" + " Type Value Effective Date\n", + "0 Deduction Rate 0.1 2010-01-01" ] }, - "execution_count": 25, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "married_couples_allowance_data = [\n", - " {\n", - " \"Name\": \"deduction_rate\",\n", - " \"Value\": \"2010-01-01: 10%\",\n", - " \"Unit\": \"/1\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(married_couples_allowance_data)\n", + "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", + "\n", + "data = {\n", + " \"Type\": [\"Deduction Rate\"],\n", + " \"Value\": [\n", + " deduction_rate.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " deduction_rate.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", "df\n", "\n" ] @@ -529,7 +569,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 71, "metadata": { "cellView": "form", "colab": { @@ -561,75 +601,70 @@ " \n", " \n", " \n", - " Date\n", - " Allowance Amount\n", - " Unit\n", + " Personal Allowance Amount (£)\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " 2015-04-06\n", - " 10600\n", - " currency-GBP\n", + " 12570\n", + " 2025-04-06\n", " \n", " \n", " 1\n", - " 2017-04-06\n", - " 11500\n", - " currency-GBP\n", + " 12570\n", + " 2021-04-06\n", " \n", " \n", " 2\n", - " 2018-04-06\n", - " 11850\n", - " currency-GBP\n", + " 12500\n", + " 2019-04-06\n", " \n", " \n", " 3\n", - " 2019-04-06\n", - " 12500\n", - " currency-GBP\n", + " 11850\n", + " 2018-04-06\n", " \n", " \n", " 4\n", - " 2021-04-06\n", - " 12570\n", - " currency-GBP\n", + " 11500\n", + " 2017-04-06\n", " \n", " \n", " 5\n", - " 2025-04-06\n", - " 12570\n", - " currency-GBP\n", + " 10600\n", + " 2015-04-06\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Date Allowance Amount Unit\n", - "0 2015-04-06 10600 currency-GBP\n", - "1 2017-04-06 11500 currency-GBP\n", - "2 2018-04-06 11850 currency-GBP\n", - "3 2019-04-06 12500 currency-GBP\n", - "4 2021-04-06 12570 currency-GBP\n", - "5 2025-04-06 12570 currency-GBP" + " Personal Allowance Amount (£) Effective Date\n", + "0 12570 2025-04-06\n", + "1 12570 2021-04-06\n", + "2 12500 2019-04-06\n", + "3 11850 2018-04-06\n", + "4 11500 2017-04-06\n", + "5 10600 2015-04-06" ] }, - "execution_count": 28, + "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "dates = ['2015-04-06', '2017-04-06', '2018-04-06', '2019-04-06', '2021-04-06', '2025-04-06']\n", - "values = [10600, 11500, 11850, 12500, 12570, 12570]\n", + "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", + "\n", + "values = [item.value for item in amount.values_list]\n", + "dates = [item.instant_str for item in amount.values_list]\n", + "\n", "\n", "df = pd.DataFrame({\n", - " 'Date': dates,\n", - " 'Allowance Amount': values,\n", - " 'Unit': \"currency-GBP\"\n", + " \"Personal Allowance Amount (£)\": values, \n", + " \"Effective Date\": dates\n", "})\n", "\n", "df\n", @@ -647,7 +682,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 72, "metadata": { "cellView": "form", "colab": { @@ -678,69 +713,66 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " additional threshold\n", - " 2005-06-01: 0\n", - " currency-GBP\n", + " Addtional Threshold\n", + " 0\n", + " 2005-06-01\n", " \n", " \n", " 1\n", - " basic threshold\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", + " Basic Threshold\n", + " 1000\n", + " 2005-06-01\n", " \n", " \n", " 2\n", - " higher threshold\n", - " 2005-06-01: 500\n", - " currency-GBP\n", + " Higher Threshold\n", + " 500\n", + " 2005-06-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 additional threshold 2005-06-01: 0 currency-GBP\n", - "1 basic threshold 2005-06-01: 1,000 currency-GBP\n", - "2 higher threshold 2005-06-01: 500 currency-GBP" + " Type Value Effective Date\n", + "0 Addtional Threshold 0 2005-06-01\n", + "1 Basic Threshold 1000 2005-06-01\n", + "2 Higher Threshold 500 2005-06-01" ] }, - "execution_count": 29, + "execution_count": 72, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "personal_savings_allowance_data = [\n", - " {\n", - " \"Name\": \"additional threshold\",\n", - " \"Value\": \"2005-06-01: 0\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"basic threshold\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"higher threshold\",\n", - " \"Value\": \"2005-06-01: 500\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(personal_savings_allowance_data)\n", - "df\n", + "addtional_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", + "basic_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.basic\n", + "higher_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.higher\n", "\n", - "\n" + "data = {\n", + " \"Type\": [\"Addtional Threshold\", \"Basic Threshold\", \"Higher Threshold\"],\n", + " \"Value\": [\n", + " addtional_threshold.values_list[-1].value,\n", + " basic_threshold.values_list[-1].value,\n", + " higher_threshold.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " addtional_threshold.values_list[-1].instant_str,\n", + " basic_threshold.values_list[-1].instant_str,\n", + " higher_threshold.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "df" ] }, { @@ -754,7 +786,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 73, "metadata": { "cellView": "form", "colab": { @@ -785,42 +817,45 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " dividend_allowance\n", - " 2015-06-05: 2,000\n", - " currency-GBP\n", + " Dividend Allowance\n", + " 2000\n", + " 2015-06-05\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 dividend_allowance 2015-06-05: 2,000 currency-GBP" + " Type Value Effective Date\n", + "0 Dividend Allowance 2000 2015-06-05" ] }, - "execution_count": 30, + "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "dividend_allowance_data = [\n", - " {\n", - " \"Name\": \"dividend_allowance\",\n", - " \"Value\": \"2015-06-05: 2,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(dividend_allowance_data)\n", + "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", + "\n", + "data = {\n", + " \"Type\": [\"Dividend Allowance\"],\n", + " \"Value\": [\n", + " dividend_allowance.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " dividend_allowance.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", "df" ] }, @@ -835,7 +870,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 65, "metadata": { "cellView": "form", "colab": { @@ -866,43 +901,46 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " property_allowance\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", + " Property Allowance\n", + " 1000\n", + " 2005-06-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 property_allowance 2005-06-01: 1,000 currency-GBP" + " Type Value Effective Date\n", + "0 Property Allowance 1000 2005-06-01" ] }, - "execution_count": 31, + "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "property_allowance_data = [\n", - " {\n", - " \"Name\": \"property_allowance\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(property_allowance_data)\n", - "df\n" + "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", + "\n", + "data = {\n", + " \"Type\": [\"Property Allowance\"],\n", + " \"Value\": [\n", + " property_allowance.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " property_allowance.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "df" ] }, { @@ -916,7 +954,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 66, "metadata": { "cellView": "form", "colab": { @@ -947,44 +985,46 @@ " \n", " \n", " \n", - " Name\n", + " Type\n", " Value\n", - " Unit\n", + " Effective Date\n", " \n", " \n", " \n", " \n", " 0\n", - " trading_allowance\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", + " Trading Allowance\n", + " 1000\n", + " 2005-06-01\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Name Value Unit\n", - "0 trading_allowance 2005-06-01: 1,000 currency-GBP" + " Type Value Effective Date\n", + "0 Trading Allowance 1000 2005-06-01" ] }, - "execution_count": 33, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "trading_allowance_data = [\n", - " {\n", - " \"Name\": \"trading_allowance\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(trading_allowance_data)\n", - "df\n", - "\n" + "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", + "\n", + "data = {\n", + " \"Type\": [\"Trading Allowance\"],\n", + " \"Value\": [\n", + " trading_allowance.values_list[-1].value\n", + " ],\n", + " \"Effective Date\": [\n", + " trading_allowance.values_list[-1].instant_str\n", + " ]\n", + "}\n", + "df = pd.DataFrame(data)\n", + "df\n" ] }, { @@ -993,6 +1033,4997 @@ "source": [ "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Simulation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The figure illustrates the implementation of a simulation for computing income tax and dividend income tax using PolicyEngine UK model. The simulation is conducted for an individual aged 30 with a fixed dividend income of £10,000 while varying the employment income between £0 and £200,000." + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "config": { + "plotlyServerURL": "https://plot.ly" + }, + "data": [ + { + "hovertemplate": "Tax type=Income tax
Employment income=%{x}
Income tax (£)=%{y}", + "legendgroup": "Income tax", + "line": { + "color": "#636efa", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "Income tax", + "showlegend": true, + "type": "scattergl", + "x": [ + 0, + 200.2001953125, + 400.400390625, + 600.6005859375, + 800.80078125, + 1001.0009765625, + 1201.201171875, + 1401.4013671875, + 1601.6015625, + 1801.8017578125, + 2002.001953125, + 2202.2021484375, + 2402.40234375, + 2602.6025390625, + 2802.802734375, + 3003.0029296875, + 3203.203125, + 3403.4033203125, + 3603.603515625, + 3803.8037109375, + 4004.00390625, + 4204.2041015625, + 4404.404296875, + 4604.6044921875, + 4804.8046875, + 5005.0048828125, + 5205.205078125, + 5405.4052734375, + 5605.60546875, + 5805.8056640625, + 6006.005859375, + 6206.2060546875, + 6406.40625, + 6606.6064453125, + 6806.806640625, + 7007.0068359375, + 7207.20703125, + 7407.4072265625, + 7607.607421875, + 7807.8076171875, + 8008.0078125, + 8208.2080078125, + 8408.408203125, + 8608.6083984375, + 8808.80859375, + 9009.0087890625, + 9209.208984375, + 9409.4091796875, + 9609.609375, + 9809.8095703125, + 10010.009765625, + 10210.2099609375, + 10410.41015625, + 10610.6103515625, + 10810.810546875, + 11011.0107421875, + 11211.2109375, + 11411.4111328125, + 11611.611328125, + 11811.8115234375, + 12012.01171875, + 12212.2119140625, + 12412.412109375, + 12612.6123046875, + 12812.8125, + 13013.0126953125, + 13213.212890625, + 13413.4130859375, + 13613.61328125, + 13813.8134765625, + 14014.013671875, + 14214.2138671875, + 14414.4140625, + 14614.6142578125, + 14814.814453125, + 15015.0146484375, + 15215.21484375, + 15415.4150390625, + 15615.615234375, + 15815.8154296875, + 16016.015625, + 16216.2158203125, + 16416.416015625, + 16616.6171875, + 16816.81640625, + 17017.017578125, + 17217.216796875, + 17417.41796875, + 17617.6171875, + 17817.818359375, + 18018.017578125, + 18218.21875, + 18418.41796875, + 18618.619140625, + 18818.818359375, + 19019.01953125, + 19219.21875, + 19419.419921875, + 19619.619140625, + 19819.8203125, + 20020.01953125, + 20220.220703125, + 20420.419921875, + 20620.62109375, + 20820.8203125, + 21021.021484375, + 21221.220703125, + 21421.421875, + 21621.62109375, + 21821.822265625, + 22022.021484375, + 22222.22265625, + 22422.421875, + 22622.623046875, + 22822.822265625, + 23023.0234375, + 23223.22265625, + 23423.423828125, + 23623.623046875, + 23823.82421875, + 24024.0234375, + 24224.224609375, + 24424.423828125, + 24624.625, + 24824.82421875, + 25025.025390625, + 25225.224609375, + 25425.42578125, + 25625.625, + 25825.826171875, + 26026.025390625, + 26226.2265625, + 26426.42578125, + 26626.626953125, + 26826.826171875, + 27027.02734375, + 27227.2265625, + 27427.427734375, + 27627.626953125, + 27827.828125, + 28028.02734375, + 28228.228515625, + 28428.427734375, + 28628.62890625, + 28828.828125, + 29029.029296875, + 29229.228515625, + 29429.4296875, + 29629.62890625, + 29829.830078125, + 30030.029296875, + 30230.23046875, + 30430.4296875, + 30630.630859375, + 30830.830078125, + 31031.03125, + 31231.23046875, + 31431.431640625, + 31631.630859375, + 31831.83203125, + 32032.03125, + 32232.232421875, + 32432.431640625, + 32632.6328125, + 32832.83203125, + 33033.03125, + 33233.234375, + 33433.43359375, + 33633.6328125, + 33833.83203125, + 34034.03515625, + 34234.234375, + 34434.43359375, + 34634.6328125, + 34834.8359375, + 35035.03515625, + 35235.234375, + 35435.43359375, + 35635.63671875, + 35835.8359375, + 36036.03515625, + 36236.234375, + 36436.4375, + 36636.63671875, + 36836.8359375, + 37037.03515625, + 37237.23828125, + 37437.4375, + 37637.63671875, + 37837.8359375, + 38038.0390625, + 38238.23828125, + 38438.4375, + 38638.63671875, + 38838.83984375, + 39039.0390625, + 39239.23828125, + 39439.4375, + 39639.640625, + 39839.83984375, + 40040.0390625, + 40240.2421875, + 40440.44140625, + 40640.640625, + 40840.83984375, + 41041.04296875, + 41241.2421875, + 41441.44140625, + 41641.640625, + 41841.84375, + 42042.04296875, + 42242.2421875, + 42442.44140625, + 42642.64453125, + 42842.84375, + 43043.04296875, + 43243.2421875, + 43443.4453125, + 43643.64453125, + 43843.84375, + 44044.04296875, + 44244.24609375, + 44444.4453125, + 44644.64453125, + 44844.84375, + 45045.046875, + 45245.24609375, + 45445.4453125, + 45645.64453125, + 45845.84765625, + 46046.046875, + 46246.24609375, + 46446.4453125, + 46646.6484375, + 46846.84765625, + 47047.046875, + 47247.24609375, + 47447.44921875, + 47647.6484375, + 47847.84765625, + 48048.046875, + 48248.25, + 48448.44921875, + 48648.6484375, + 48848.84765625, + 49049.05078125, + 49249.25, + 49449.44921875, + 49649.6484375, + 49849.8515625, + 50050.05078125, + 50250.25, + 50450.44921875, + 50650.65234375, + 50850.8515625, + 51051.05078125, + 51251.25, + 51451.453125, + 51651.65234375, + 51851.8515625, + 52052.05078125, + 52252.25390625, + 52452.453125, + 52652.65234375, + 52852.8515625, + 53053.0546875, + 53253.25390625, + 53453.453125, + 53653.65234375, + 53853.85546875, + 54054.0546875, + 54254.25390625, + 54454.453125, + 54654.65625, + 54854.85546875, + 55055.0546875, + 55255.25390625, + 55455.45703125, + 55655.65625, + 55855.85546875, + 56056.0546875, + 56256.2578125, + 56456.45703125, + 56656.65625, + 56856.85546875, + 57057.05859375, + 57257.2578125, + 57457.45703125, + 57657.65625, + 57857.859375, + 58058.05859375, + 58258.2578125, + 58458.45703125, + 58658.66015625, + 58858.859375, + 59059.05859375, + 59259.2578125, + 59459.4609375, + 59659.66015625, + 59859.859375, + 60060.05859375, + 60260.26171875, + 60460.4609375, + 60660.66015625, + 60860.859375, + 61061.0625, + 61261.26171875, + 61461.4609375, + 61661.66015625, + 61861.86328125, + 62062.0625, + 62262.26171875, + 62462.4609375, + 62662.6640625, + 62862.86328125, + 63063.0625, + 63263.26171875, + 63463.46484375, + 63663.6640625, + 63863.86328125, + 64064.0625, + 64264.265625, + 64464.46484375, + 64664.6640625, + 64864.86328125, + 65065.06640625, + 65265.265625, + 65465.46484375, + 65665.6640625, + 65865.8671875, + 66066.0625, + 66266.265625, + 66466.46875, + 66666.6640625, + 66866.8671875, + 67067.0703125, + 67267.265625, + 67467.46875, + 67667.6640625, + 67867.8671875, + 68068.0703125, + 68268.265625, + 68468.46875, + 68668.671875, + 68868.8671875, + 69069.0703125, + 69269.265625, + 69469.46875, + 69669.671875, + 69869.8671875, + 70070.0703125, + 70270.2734375, + 70470.46875, + 70670.671875, + 70870.8671875, + 71071.0703125, + 71271.2734375, + 71471.46875, + 71671.671875, + 71871.875, + 72072.0703125, + 72272.2734375, + 72472.46875, + 72672.671875, + 72872.875, + 73073.0703125, + 73273.2734375, + 73473.4765625, + 73673.671875, + 73873.875, + 74074.0703125, + 74274.2734375, + 74474.4765625, + 74674.671875, + 74874.875, + 75075.078125, + 75275.2734375, + 75475.4765625, + 75675.671875, + 75875.875, + 76076.078125, + 76276.2734375, + 76476.4765625, + 76676.6796875, + 76876.875, + 77077.078125, + 77277.2734375, + 77477.4765625, + 77677.6796875, + 77877.875, + 78078.078125, + 78278.28125, + 78478.4765625, + 78678.6796875, + 78878.875, + 79079.078125, + 79279.28125, + 79479.4765625, + 79679.6796875, + 79879.8828125, + 80080.078125, + 80280.28125, + 80480.484375, + 80680.6796875, + 80880.8828125, + 81081.078125, + 81281.28125, + 81481.484375, + 81681.6796875, + 81881.8828125, + 82082.0859375, + 82282.28125, + 82482.484375, + 82682.6796875, + 82882.8828125, + 83083.0859375, + 83283.28125, + 83483.484375, + 83683.6875, + 83883.8828125, + 84084.0859375, + 84284.28125, + 84484.484375, + 84684.6875, + 84884.8828125, + 85085.0859375, + 85285.2890625, + 85485.484375, + 85685.6875, + 85885.8828125, + 86086.0859375, + 86286.2890625, + 86486.484375, + 86686.6875, + 86886.890625, + 87087.0859375, + 87287.2890625, + 87487.484375, + 87687.6875, + 87887.890625, + 88088.0859375, + 88288.2890625, + 88488.4921875, + 88688.6875, + 88888.890625, + 89089.0859375, + 89289.2890625, + 89489.4921875, + 89689.6875, + 89889.890625, + 90090.09375, + 90290.2890625, + 90490.4921875, + 90690.6875, + 90890.890625, + 91091.09375, + 91291.2890625, + 91491.4921875, + 91691.6953125, + 91891.890625, + 92092.09375, + 92292.2890625, + 92492.4921875, + 92692.6953125, + 92892.890625, + 93093.09375, + 93293.296875, + 93493.4921875, + 93693.6953125, + 93893.890625, + 94094.09375, + 94294.296875, + 94494.4921875, + 94694.6953125, + 94894.8984375, + 95095.09375, + 95295.296875, + 95495.4921875, + 95695.6953125, + 95895.8984375, + 96096.09375, + 96296.296875, + 96496.5, + 96696.6953125, + 96896.8984375, + 97097.09375, + 97297.296875, + 97497.5, + 97697.6953125, + 97897.8984375, + 98098.1015625, + 98298.296875, + 98498.5, + 98698.6953125, + 98898.8984375, + 99099.1015625, + 99299.296875, + 99499.5, + 99699.703125, + 99899.8984375, + 100100.1015625, + 100300.296875, + 100500.5, + 100700.703125, + 100900.8984375, + 101101.1015625, + 101301.3046875, + 101501.5, + 101701.703125, + 101901.8984375, + 102102.1015625, + 102302.3046875, + 102502.5, + 102702.703125, + 102902.90625, + 103103.1015625, + 103303.3046875, + 103503.5, + 103703.703125, + 103903.90625, + 104104.1015625, + 104304.3046875, + 104504.5078125, + 104704.703125, + 104904.90625, + 105105.1015625, + 105305.3046875, + 105505.5078125, + 105705.703125, + 105905.90625, + 106106.109375, + 106306.3046875, + 106506.5078125, + 106706.703125, + 106906.90625, + 107107.109375, + 107307.3046875, + 107507.5078125, + 107707.7109375, + 107907.90625, + 108108.109375, + 108308.3046875, + 108508.5078125, + 108708.7109375, + 108908.90625, + 109109.109375, + 109309.3125, + 109509.5078125, + 109709.7109375, + 109909.90625, + 110110.109375, + 110310.3125, + 110510.5078125, + 110710.7109375, + 110910.9140625, + 111111.109375, + 111311.3125, + 111511.5078125, + 111711.7109375, + 111911.9140625, + 112112.109375, + 112312.3125, + 112512.515625, + 112712.7109375, + 112912.9140625, + 113113.109375, + 113313.3125, + 113513.515625, + 113713.7109375, + 113913.9140625, + 114114.1171875, + 114314.3125, + 114514.515625, + 114714.7109375, + 114914.9140625, + 115115.1171875, + 115315.3125, + 115515.515625, + 115715.71875, + 115915.9140625, + 116116.1171875, + 116316.3125, + 116516.515625, + 116716.71875, + 116916.9140625, + 117117.1171875, + 117317.3203125, + 117517.515625, + 117717.71875, + 117917.9140625, + 118118.1171875, + 118318.3203125, + 118518.515625, + 118718.71875, + 118918.921875, + 119119.1171875, + 119319.3203125, + 119519.515625, + 119719.71875, + 119919.921875, + 120120.1171875, + 120320.3203125, + 120520.5234375, + 120720.71875, + 120920.921875, + 121121.125, + 121321.3203125, + 121521.5234375, + 121721.71875, + 121921.921875, + 122122.125, + 122322.3203125, + 122522.5234375, + 122722.7265625, + 122922.921875, + 123123.125, + 123323.3203125, + 123523.5234375, + 123723.7265625, + 123923.921875, + 124124.125, + 124324.328125, + 124524.5234375, + 124724.7265625, + 124924.921875, + 125125.125, + 125325.328125, + 125525.5234375, + 125725.7265625, + 125925.9296875, + 126126.125, + 126326.328125, + 126526.5234375, + 126726.7265625, + 126926.9296875, + 127127.125, + 127327.328125, + 127527.53125, + 127727.7265625, + 127927.9296875, + 128128.125, + 128328.328125, + 128528.53125, + 128728.7265625, + 128928.9296875, + 129129.1328125, + 129329.328125, + 129529.53125, + 129729.7265625, + 129929.9296875, + 130130.1328125, + 130330.328125, + 130530.53125, + 130730.734375, + 130930.9296875, + 131131.125, + 131331.328125, + 131531.53125, + 131731.734375, + 131931.9375, + 132132.125, + 132332.328125, + 132532.53125, + 132732.734375, + 132932.9375, + 133133.140625, + 133333.328125, + 133533.53125, + 133733.734375, + 133933.9375, + 134134.140625, + 134334.328125, + 134534.53125, + 134734.734375, + 134934.9375, + 135135.140625, + 135335.328125, + 135535.53125, + 135735.734375, + 135935.9375, + 136136.140625, + 136336.34375, + 136536.53125, + 136736.734375, + 136936.9375, + 137137.140625, + 137337.34375, + 137537.53125, + 137737.734375, + 137937.9375, + 138138.140625, + 138338.34375, + 138538.53125, + 138738.734375, + 138938.9375, + 139139.140625, + 139339.34375, + 139539.546875, + 139739.734375, + 139939.9375, + 140140.140625, + 140340.34375, + 140540.546875, + 140740.734375, + 140940.9375, + 141141.140625, + 141341.34375, + 141541.546875, + 141741.734375, + 141941.9375, + 142142.140625, + 142342.34375, + 142542.546875, + 142742.75, + 142942.9375, + 143143.140625, + 143343.34375, + 143543.546875, + 143743.75, + 143943.9375, + 144144.140625, + 144344.34375, + 144544.546875, + 144744.75, + 144944.9375, + 145145.140625, + 145345.34375, + 145545.546875, + 145745.75, + 145945.953125, + 146146.140625, + 146346.34375, + 146546.546875, + 146746.75, + 146946.953125, + 147147.140625, + 147347.34375, + 147547.546875, + 147747.75, + 147947.953125, + 148148.140625, + 148348.34375, + 148548.546875, + 148748.75, + 148948.953125, + 149149.15625, + 149349.34375, + 149549.546875, + 149749.75, + 149949.953125, + 150150.15625, + 150350.34375, + 150550.546875, + 150750.75, + 150950.953125, + 151151.15625, + 151351.34375, + 151551.546875, + 151751.75, + 151951.953125, + 152152.15625, + 152352.359375, + 152552.546875, + 152752.75, + 152952.953125, + 153153.15625, + 153353.359375, + 153553.546875, + 153753.75, + 153953.953125, + 154154.15625, + 154354.359375, + 154554.546875, + 154754.75, + 154954.953125, + 155155.15625, + 155355.359375, + 155555.5625, + 155755.75, + 155955.953125, + 156156.15625, + 156356.359375, + 156556.5625, + 156756.75, + 156956.953125, + 157157.15625, + 157357.359375, + 157557.5625, + 157757.75, + 157957.953125, + 158158.15625, + 158358.359375, + 158558.5625, + 158758.765625, + 158958.953125, + 159159.15625, + 159359.359375, + 159559.5625, + 159759.765625, + 159959.953125, + 160160.15625, + 160360.359375, + 160560.5625, + 160760.765625, + 160960.96875, + 161161.15625, + 161361.359375, + 161561.5625, + 161761.765625, + 161961.96875, + 162162.15625, + 162362.359375, + 162562.5625, + 162762.765625, + 162962.96875, + 163163.15625, + 163363.359375, + 163563.5625, + 163763.765625, + 163963.96875, + 164164.171875, + 164364.359375, + 164564.5625, + 164764.765625, + 164964.96875, + 165165.171875, + 165365.359375, + 165565.5625, + 165765.765625, + 165965.96875, + 166166.171875, + 166366.359375, + 166566.5625, + 166766.765625, + 166966.96875, + 167167.171875, + 167367.375, + 167567.5625, + 167767.765625, + 167967.96875, + 168168.171875, + 168368.375, + 168568.5625, + 168768.765625, + 168968.96875, + 169169.171875, + 169369.375, + 169569.5625, + 169769.765625, + 169969.96875, + 170170.171875, + 170370.375, + 170570.578125, + 170770.765625, + 170970.96875, + 171171.171875, + 171371.375, + 171571.578125, + 171771.765625, + 171971.96875, + 172172.171875, + 172372.375, + 172572.578125, + 172772.765625, + 172972.96875, + 173173.171875, + 173373.375, + 173573.578125, + 173773.78125, + 173973.96875, + 174174.171875, + 174374.375, + 174574.578125, + 174774.78125, + 174974.96875, + 175175.171875, + 175375.375, + 175575.578125, + 175775.78125, + 175975.96875, + 176176.171875, + 176376.375, + 176576.578125, + 176776.78125, + 176976.984375, + 177177.171875, + 177377.375, + 177577.578125, + 177777.78125, + 177977.984375, + 178178.171875, + 178378.375, + 178578.578125, + 178778.78125, + 178978.984375, + 179179.171875, + 179379.375, + 179579.578125, + 179779.78125, + 179979.984375, + 180180.1875, + 180380.375, + 180580.578125, + 180780.78125, + 180980.984375, + 181181.1875, + 181381.375, + 181581.578125, + 181781.78125, + 181981.984375, + 182182.1875, + 182382.375, + 182582.578125, + 182782.78125, + 182982.984375, + 183183.1875, + 183383.390625, + 183583.578125, + 183783.78125, + 183983.984375, + 184184.1875, + 184384.390625, + 184584.578125, + 184784.78125, + 184984.984375, + 185185.1875, + 185385.390625, + 185585.578125, + 185785.78125, + 185985.984375, + 186186.1875, + 186386.390625, + 186586.59375, + 186786.78125, + 186986.984375, + 187187.1875, + 187387.390625, + 187587.59375, + 187787.78125, + 187987.984375, + 188188.1875, + 188388.390625, + 188588.59375, + 188788.78125, + 188988.984375, + 189189.1875, + 189389.390625, + 189589.59375, + 189789.796875, + 189989.984375, + 190190.1875, + 190390.390625, + 190590.59375, + 190790.796875, + 190990.984375, + 191191.1875, + 191391.390625, + 191591.59375, + 191791.796875, + 191991.984375, + 192192.1875, + 192392.390625, + 192592.59375, + 192792.796875, + 192993, + 193193.1875, + 193393.390625, + 193593.59375, + 193793.796875, + 193994, + 194194.1875, + 194394.390625, + 194594.59375, + 194794.796875, + 194995, + 195195.1875, + 195395.390625, + 195595.59375, + 195795.796875, + 195996, + 196196.203125, + 196396.390625, + 196596.59375, + 196796.796875, + 196997, + 197197.203125, + 197397.390625, + 197597.59375, + 197797.796875, + 197998, + 198198.203125, + 198398.390625, + 198598.59375, + 198798.796875, + 198999, + 199199.203125, + 199399.40625, + 199599.59375, + 199799.796875, + 200000 + ], + "xaxis": "x", + "y": [ + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 608.5226440429688, + 648.5625, + 688.6023559570312, + 728.642578125, + 768.6828002929688, + 808.72265625, + 848.7625122070312, + 888.802734375, + 928.8429565429688, + 968.8828125, + 1008.9226684570312, + 1048.962890625, + 1089.003173828125, + 1129.04296875, + 1169.082763671875, + 1209.123046875, + 1249.163330078125, + 1289.203125, + 1329.242919921875, + 1369.283203125, + 1409.323486328125, + 1449.36328125, + 1489.403564453125, + 1529.443359375, + 1569.483642578125, + 1609.5234375, + 1649.563720703125, + 1689.603515625, + 1729.643798828125, + 1769.68359375, + 1809.723876953125, + 1849.763671875, + 1889.803955078125, + 1929.84375, + 1969.884033203125, + 2009.923828125, + 2049.964111328125, + 2090.00390625, + 2130.044189453125, + 2170.083984375, + 2210.124267578125, + 2250.1640625, + 2290.204345703125, + 2330.244140625, + 2370.284423828125, + 2410.32421875, + 2450.364501953125, + 2490.404296875, + 2530.444580078125, + 2570.484375, + 2610.524658203125, + 2650.56396484375, + 2690.604736328125, + 2730.64453125, + 2770.684326171875, + 2810.72509765625, + 2850.764892578125, + 2890.8046875, + 2930.84521484375, + 2970.88427734375, + 3010.925048828125, + 3050.96484375, + 3091.004638671875, + 3131.04541015625, + 3171.085205078125, + 3211.125, + 3251.16552734375, + 3291.20458984375, + 3331.245361328125, + 3371.28515625, + 3411.324951171875, + 3451.36572265625, + 3491.405517578125, + 3531.4453125, + 3571.48583984375, + 3611.52490234375, + 3651.565673828125, + 3691.60546875, + 3731.645263671875, + 3771.68603515625, + 3811.725830078125, + 3851.765625, + 3891.80615234375, + 3931.84521484375, + 3971.885986328125, + 4011.92578125, + 4051.965576171875, + 4092.00634765625, + 4132.0458984375, + 4172.0859375, + 4212.12646484375, + 4252.16552734375, + 4292.2060546875, + 4332.24609375, + 4372.2861328125, + 4412.32666015625, + 4452.3662109375, + 4492.40625, + 4532.44677734375, + 4572.48583984375, + 4612.5263671875, + 4652.56640625, + 4692.6064453125, + 4732.64697265625, + 4772.6865234375, + 4812.7265625, + 4852.7666015625, + 4892.80712890625, + 4932.8466796875, + 4972.88671875, + 5012.9267578125, + 5052.96728515625, + 5093.0068359375, + 5133.046875, + 5173.0869140625, + 5213.12744140625, + 5253.1669921875, + 5293.20703125, + 5333.2470703125, + 5373.28759765625, + 5413.3271484375, + 5453.3671875, + 5493.4072265625, + 5533.44775390625, + 5573.4873046875, + 5613.52734375, + 5653.5673828125, + 5693.60791015625, + 5733.6474609375, + 5773.6875, + 5813.7275390625, + 5853.76806640625, + 5893.8076171875, + 5933.84765625, + 5973.8876953125, + 6013.92822265625, + 6053.9677734375, + 6094.0078125, + 6134.04833984375, + 6174.08837890625, + 6214.1279296875, + 6254.16796875, + 6294.20849609375, + 6334.24853515625, + 6374.2880859375, + 6414.328125, + 6454.36865234375, + 6494.40869140625, + 6577.5087890625, + 6667.5986328125, + 6757.68994140625, + 6847.77978515625, + 6937.869140625, + 7027.958984375, + 7118.05029296875, + 7208.14013671875, + 7298.2294921875, + 7388.3193359375, + 7478.41064453125, + 7568.50048828125, + 7658.58984375, + 7748.6796875, + 7838.77099609375, + 7928.86083984375, + 8018.9501953125, + 8109.0400390625, + 8199.130859375, + 8289.220703125, + 8379.310546875, + 8469.400390625, + 8559.4921875, + 8649.58203125, + 8739.6708984375, + 8829.7607421875, + 8919.8515625, + 9009.94140625, + 9100.03125, + 9190.12109375, + 9280.212890625, + 9370.302734375, + 9460.3916015625, + 9550.4814453125, + 9640.572265625, + 9730.662109375, + 9820.751953125, + 9910.841796875, + 10000.93359375, + 10091.0234375, + 10136.0498046875, + 10212.1796875, + 10292.2607421875, + 10372.3408203125, + 10452.419921875, + 10532.5, + 10612.5810546875, + 10692.6611328125, + 10772.740234375, + 10852.8203125, + 10932.9013671875, + 11012.9814453125, + 11093.060546875, + 11173.140625, + 11253.2216796875, + 11333.3017578125, + 11413.380859375, + 11493.4609375, + 11573.5419921875, + 11653.6220703125, + 11733.701171875, + 11813.78125, + 11893.8623046875, + 11973.9423828125, + 12054.021484375, + 12134.1015625, + 12214.1826171875, + 12294.2626953125, + 12374.34375, + 12454.421875, + 12534.5029296875, + 12614.5810546875, + 12694.662109375, + 12774.744140625, + 12854.8251953125, + 12934.9033203125, + 13014.9814453125, + 13095.0625, + 13175.1435546875, + 13255.224609375, + 13335.302734375, + 13415.380859375, + 13495.462890625, + 13575.5439453125, + 13655.625, + 13735.703125, + 13815.7841796875, + 13895.8623046875, + 13975.943359375, + 14056.025390625, + 14136.1064453125, + 14216.1845703125, + 14296.2626953125, + 14376.34375, + 14456.4248046875, + 14536.505859375, + 14616.583984375, + 14696.662109375, + 14776.744140625, + 14856.8251953125, + 14936.90625, + 15016.984375, + 15097.0654296875, + 15177.1435546875, + 15257.224609375, + 15337.306640625, + 15417.3876953125, + 15497.4658203125, + 15577.5439453125, + 15657.625, + 15737.7060546875, + 15817.787109375, + 15897.865234375, + 15977.943359375, + 16058.025390625, + 16138.1064453125, + 16218.1875, + 16298.265625, + 16378.3466796875, + 16458.42578125, + 16538.505859375, + 16618.587890625, + 16698.666015625, + 16778.74609375, + 16858.828125, + 16938.90625, + 17018.98828125, + 17099.06640625, + 17179.146484375, + 17259.228515625, + 17339.306640625, + 17419.38671875, + 17499.46875, + 17579.546875, + 17659.62890625, + 17739.70703125, + 17819.787109375, + 17899.869140625, + 17979.947265625, + 18060.02734375, + 18140.109375, + 18220.1875, + 18300.26953125, + 18380.34765625, + 18460.427734375, + 18540.509765625, + 18620.587890625, + 18700.66796875, + 18780.75, + 18860.828125, + 18940.91015625, + 19020.98828125, + 19101.068359375, + 19181.150390625, + 19261.228515625, + 19341.30859375, + 19421.390625, + 19501.46875, + 19581.55078125, + 19661.62890625, + 19741.708984375, + 19821.791015625, + 19901.869140625, + 19981.94921875, + 20062.03125, + 20142.109375, + 20222.19140625, + 20302.26953125, + 20382.349609375, + 20462.431640625, + 20542.509765625, + 20622.58984375, + 20702.671875, + 20782.75, + 20862.83203125, + 20942.91015625, + 21022.990234375, + 21103.072265625, + 21183.150390625, + 21263.23046875, + 21343.3125, + 21423.390625, + 21503.47265625, + 21583.55078125, + 21663.630859375, + 21743.712890625, + 21823.791015625, + 21903.87109375, + 21983.953125, + 22064.03125, + 22144.11328125, + 22224.193359375, + 22304.271484375, + 22384.353515625, + 22464.431640625, + 22544.51171875, + 22624.59375, + 22704.671875, + 22784.75390625, + 22864.833984375, + 22944.912109375, + 23024.994140625, + 23105.072265625, + 23185.15234375, + 23265.234375, + 23345.3125, + 23425.39453125, + 23505.474609375, + 23585.552734375, + 23665.634765625, + 23745.712890625, + 23825.79296875, + 23905.875, + 23985.953125, + 24066.03515625, + 24146.115234375, + 24226.193359375, + 24306.275390625, + 24386.353515625, + 24466.43359375, + 24546.515625, + 24626.59375, + 24706.67578125, + 24786.755859375, + 24866.833984375, + 24946.916015625, + 25026.994140625, + 25107.07421875, + 25187.15625, + 25267.234375, + 25347.31640625, + 25427.396484375, + 25507.474609375, + 25587.556640625, + 25667.634765625, + 25747.71484375, + 25827.796875, + 25907.875, + 25987.95703125, + 26086.056640625, + 26206.17578125, + 26326.29296875, + 26446.412109375, + 26566.53515625, + 26686.65625, + 26806.775390625, + 26926.89453125, + 27047.01953125, + 27167.134765625, + 27287.255859375, + 27407.375, + 27527.494140625, + 27647.619140625, + 27767.734375, + 27887.85546875, + 28007.978515625, + 28128.09375, + 28248.21875, + 28368.333984375, + 28488.45703125, + 28608.578125, + 28728.693359375, + 28848.818359375, + 28968.9375, + 29089.056640625, + 29209.177734375, + 29329.29296875, + 29449.41796875, + 29569.537109375, + 29689.65625, + 29809.77734375, + 29929.900390625, + 30050.01953125, + 30170.13671875, + 30290.255859375, + 30410.37890625, + 30530.5, + 30650.619140625, + 30770.73828125, + 30890.86328125, + 31010.978515625, + 31131.099609375, + 31251.21875, + 31371.337890625, + 31491.462890625, + 31611.578125, + 31731.69921875, + 31851.822265625, + 31971.9375, + 32092.0625, + 32212.177734375, + 32332.30078125, + 32452.421875, + 32572.537109375, + 32692.662109375, + 32812.78125, + 32932.8984375, + 33053.0234375, + 33173.13671875, + 33293.26171875, + 33413.3828125, + 33533.5, + 33653.62109375, + 33773.7421875, + 33893.86328125, + 34013.98046875, + 34134.1015625, + 34254.22265625, + 34374.34375, + 34494.4609375, + 34614.58203125, + 34734.70703125, + 34854.8203125, + 34974.9453125, + 35095.0625, + 35215.1796875, + 35335.3046875, + 35455.421875, + 35575.54296875, + 35695.6640625, + 35815.78125, + 35935.90625, + 36056.0234375, + 36176.14453125, + 36296.265625, + 36416.3828125, + 36536.5078125, + 36656.625, + 36776.7421875, + 36896.8671875, + 37016.98046875, + 37137.10546875, + 37257.2265625, + 37377.34375, + 37497.46484375, + 37617.5859375, + 37737.70703125, + 37857.82421875, + 37977.9453125, + 38098.06640625, + 38218.1875, + 38338.3046875, + 38458.42578125, + 38578.55078125, + 38698.6640625, + 38818.7890625, + 38938.90625, + 39059.0234375, + 39179.1484375, + 39299.265625, + 39419.38671875, + 39539.5078125, + 39659.625, + 39779.75, + 39899.8671875, + 40019.98828125, + 40140.109375, + 40260.2265625, + 40380.3515625, + 40500.46875, + 40620.5859375, + 40740.7109375, + 40860.82421875, + 40980.94921875, + 41101.0703125, + 41186.125, + 41266.20703125, + 41346.2890625, + 41426.3671875, + 41506.4453125, + 41586.5234375, + 41666.60546875, + 41746.6875, + 41826.765625, + 41906.84765625, + 41986.9296875, + 42067.0078125, + 42147.0859375, + 42227.1640625, + 42307.24609375, + 42387.328125, + 42467.40625, + 42547.48828125, + 42627.5703125, + 42707.6484375, + 42787.7265625, + 42867.8046875, + 42947.88671875, + 43027.96875, + 43108.046875, + 43188.12890625, + 43268.2109375, + 43348.2890625, + 43428.3671875, + 43508.44921875, + 43588.5234375, + 43668.61328125, + 43748.6875, + 43828.76953125, + 43908.8515625, + 43988.92578125, + 44069.01171875, + 44149.0859375, + 44229.16796875, + 44309.25, + 44389.32421875, + 44469.4140625, + 44549.48828125, + 44629.5703125, + 44709.6484375, + 44789.73046875, + 44869.8125, + 44949.88671875, + 45029.96875, + 45110.05078125, + 45190.1328125, + 45270.2109375, + 45350.2890625, + 45430.375, + 45510.44921875, + 45590.53125, + 45670.61328125, + 45750.6875, + 45830.7734375, + 45910.8515625, + 45990.9296875, + 46071.01171875, + 46151.0859375, + 46231.17578125, + 46311.25, + 46391.33203125, + 46471.4140625, + 46551.48828125, + 46631.57421875, + 46711.6484375, + 46791.73046875, + 46871.8125, + 46951.88671875, + 47031.9765625, + 47112.05078125, + 47192.1328125, + 47272.2109375, + 47352.29296875, + 47432.375, + 47512.44921875, + 47592.53125, + 47672.61328125, + 47752.6953125, + 47832.7734375, + 47912.8515625, + 47992.9296875, + 48073.01171875, + 48153.09375, + 48233.17578125, + 48313.2578125, + 48393.33203125, + 48473.4140625, + 48553.4921875, + 48633.57421875, + 48713.65625, + 48793.73046875, + 48873.8125, + 48953.89453125, + 49033.9765625, + 49114.0546875, + 49194.1328125, + 49274.2109375, + 49354.29296875, + 49434.375, + 49514.45703125, + 49594.5390625, + 49674.61328125, + 49754.6953125, + 49834.7734375, + 49914.85546875, + 49994.9375, + 50075.01171875, + 50155.09375, + 50235.17578125, + 50315.2578125, + 50395.3359375, + 50475.4140625, + 50555.4921875, + 50635.57421875, + 50715.65625, + 50795.73828125, + 50875.8203125, + 50955.89453125, + 51035.9765625, + 51116.0546875, + 51196.13671875, + 51276.21875, + 51356.29296875, + 51436.375, + 51516.45703125, + 51596.5390625, + 51676.6171875, + 51756.6953125, + 51836.7734375, + 51924.81640625, + 52016.109375, + 52107.40234375, + 52198.6953125, + 52289.98046875, + 52381.2734375, + 52472.5625, + 52563.85546875, + 52655.1484375, + 52746.43359375, + 52837.7265625, + 52929.0234375, + 53020.31640625, + 53111.60546875, + 53202.89453125, + 53294.18359375, + 53385.4765625, + 53476.76953125, + 53568.0625, + 53659.35546875, + 53750.640625, + 53841.93359375, + 53933.22265625, + 54024.515625, + 54115.8125, + 54207.09375, + 54298.390625, + 54389.68359375, + 54480.9765625, + 54572.265625, + 54663.5546875, + 54754.84375, + 54846.13671875, + 54937.4296875, + 55028.72265625, + 55120.015625, + 55211.30078125, + 55302.59375, + 55393.8828125, + 55485.1796875, + 55575.5703125, + 55665.65625, + 55755.74609375, + 55845.8359375, + 55935.9296875, + 56026.01953125, + 56116.10546875, + 56206.1953125, + 56296.2890625, + 56386.37890625, + 56476.46875, + 56566.5625, + 56656.64453125, + 56746.73828125, + 56836.828125, + 56926.921875, + 57017.01171875, + 57107.09765625, + 57197.1875, + 57287.27734375, + 57377.37109375, + 57467.4609375, + 57557.546875, + 57647.63671875, + 57737.73046875, + 57827.8203125, + 57917.91015625, + 58008.00390625, + 58098.0859375, + 58188.1796875, + 58278.26953125, + 58368.36328125, + 58458.453125, + 58548.5390625, + 58638.62890625, + 58728.71875, + 58818.8125, + 58908.90234375, + 58998.98828125, + 59089.078125, + 59179.171875, + 59269.26171875, + 59359.3515625, + 59449.4453125, + 59539.52734375, + 59629.62109375, + 59719.7109375, + 59809.8046875, + 59899.89453125, + 59989.98046875, + 60080.0703125, + 60170.16015625, + 60260.25390625, + 60350.34375, + 60440.4375, + 60530.51953125, + 60620.61328125, + 60710.703125, + 60800.79296875, + 60890.88671875, + 60980.96875, + 61071.0625, + 61161.15234375, + 61251.24609375, + 61341.3359375, + 61431.421875, + 61521.51171875, + 61611.6015625, + 61701.6953125, + 61791.78515625, + 61881.87890625, + 61971.9609375, + 62062.0546875, + 62152.14453125, + 62242.234375, + 62332.328125, + 62422.41015625, + 62512.50390625, + 62602.59375, + 62692.6875, + 62782.77734375, + 62872.86328125, + 62962.953125, + 63053.04296875, + 63143.13671875, + 63233.2265625, + 63323.3203125, + 63413.40234375, + 63503.49609375, + 63593.5859375, + 63683.67578125, + 63773.76953125, + 63863.8515625, + 63953.9453125, + 64044.03515625, + 64134.12890625, + 64224.21875, + 64314.3046875, + 64404.39453125, + 64494.484375, + 64584.578125, + 64674.66796875, + 64764.76171875, + 64854.84375, + 64944.9375, + 65035.02734375, + 65125.1171875, + 65215.2109375, + 65305.29296875, + 65395.38671875, + 65485.4765625, + 65575.5703125, + 65665.65625, + 65755.75, + 65845.8359375, + 65935.921875, + 66026.015625, + 66116.109375, + 66206.203125, + 66296.28125, + 66386.375, + 66476.46875, + 66566.5625, + 66656.65625, + 66746.734375, + 66836.828125, + 66926.921875, + 67017.015625, + 67107.1015625, + 67197.1875, + 67287.28125, + 67377.3671875, + 67467.4609375, + 67557.546875, + 67647.640625, + 67737.7265625, + 67827.8203125, + 67917.90625, + 68008, + 68098.09375, + 68188.171875, + 68278.265625, + 68368.359375, + 68458.453125, + 68548.546875, + 68638.625, + 68728.71875, + 68818.8125, + 68908.8984375, + 68998.9921875, + 69089.0859375, + 69179.171875, + 69269.2578125, + 69359.3515625, + 69449.4453125, + 69539.53125, + 69629.6171875, + 69719.7109375, + 69809.8046875, + 69899.890625, + 69989.984375, + 70080.0703125, + 70170.15625, + 70260.25, + 70350.34375, + 70440.4375, + 70530.5234375, + 70620.609375, + 70710.703125, + 70800.796875, + 70890.8828125, + 70980.9765625, + 71071.0625, + 71161.1484375, + 71251.2421875, + 71341.3359375, + 71431.421875, + 71521.5078125, + 71611.6015625, + 71701.6953125, + 71791.78125, + 71881.875, + 71971.96875, + 72062.0546875, + 72152.140625, + 72242.234375, + 72332.328125, + 72422.4140625, + 72512.5, + 72602.59375, + 72692.6875, + 72782.7734375, + 72872.8671875, + 72962.953125, + 73053.046875, + 73143.1328125, + 73233.2265625, + 73323.3203125, + 73413.40625, + 73503.4921875, + 73593.5859375, + 73683.671875, + 73773.765625, + 73863.859375, + 73953.9453125, + 74044.03125, + 74134.125, + 74224.21875, + 74314.3125, + 74404.390625, + 74494.484375, + 74584.578125, + 74674.6640625, + 74764.7578125, + 74854.8515625, + 74944.9375, + 75035.0234375, + 75125.1171875, + 75215.2109375, + 75305.296875, + 75395.3828125, + 75485.4765625, + 75575.5703125, + 75665.65625, + 75755.75, + 75845.8359375, + 75935.921875, + 76026.015625, + 76116.109375, + 76206.203125, + 76296.2890625, + 76386.375, + 76476.46875, + 76566.5625, + 76656.6484375, + 76746.7421875, + 76836.828125, + 76926.9140625, + 77017.0078125, + 77107.1015625, + 77197.1875, + 77287.2734375, + 77377.3671875, + 77467.4609375, + 77557.546875, + 77647.640625, + 77737.734375, + 77827.8203125, + 77917.90625, + 78008 + ], + "yaxis": "y" + }, + { + "hovertemplate": "Tax type=Dividend income tax
Employment income=%{x}
Income tax (£)=%{y}", + "legendgroup": "Dividend income tax", + "line": { + "color": "#EF553B", + "dash": "solid" + }, + "marker": { + "symbol": "circle" + }, + "mode": "lines", + "name": "Dividend income tax", + "showlegend": true, + "type": "scattergl", + "x": [ + 0, + 200.2001953125, + 400.400390625, + 600.6005859375, + 800.80078125, + 1001.0009765625, + 1201.201171875, + 1401.4013671875, + 1601.6015625, + 1801.8017578125, + 2002.001953125, + 2202.2021484375, + 2402.40234375, + 2602.6025390625, + 2802.802734375, + 3003.0029296875, + 3203.203125, + 3403.4033203125, + 3603.603515625, + 3803.8037109375, + 4004.00390625, + 4204.2041015625, + 4404.404296875, + 4604.6044921875, + 4804.8046875, + 5005.0048828125, + 5205.205078125, + 5405.4052734375, + 5605.60546875, + 5805.8056640625, + 6006.005859375, + 6206.2060546875, + 6406.40625, + 6606.6064453125, + 6806.806640625, + 7007.0068359375, + 7207.20703125, + 7407.4072265625, + 7607.607421875, + 7807.8076171875, + 8008.0078125, + 8208.2080078125, + 8408.408203125, + 8608.6083984375, + 8808.80859375, + 9009.0087890625, + 9209.208984375, + 9409.4091796875, + 9609.609375, + 9809.8095703125, + 10010.009765625, + 10210.2099609375, + 10410.41015625, + 10610.6103515625, + 10810.810546875, + 11011.0107421875, + 11211.2109375, + 11411.4111328125, + 11611.611328125, + 11811.8115234375, + 12012.01171875, + 12212.2119140625, + 12412.412109375, + 12612.6123046875, + 12812.8125, + 13013.0126953125, + 13213.212890625, + 13413.4130859375, + 13613.61328125, + 13813.8134765625, + 14014.013671875, + 14214.2138671875, + 14414.4140625, + 14614.6142578125, + 14814.814453125, + 15015.0146484375, + 15215.21484375, + 15415.4150390625, + 15615.615234375, + 15815.8154296875, + 16016.015625, + 16216.2158203125, + 16416.416015625, + 16616.6171875, + 16816.81640625, + 17017.017578125, + 17217.216796875, + 17417.41796875, + 17617.6171875, + 17817.818359375, + 18018.017578125, + 18218.21875, + 18418.41796875, + 18618.619140625, + 18818.818359375, + 19019.01953125, + 19219.21875, + 19419.419921875, + 19619.619140625, + 19819.8203125, + 20020.01953125, + 20220.220703125, + 20420.419921875, + 20620.62109375, + 20820.8203125, + 21021.021484375, + 21221.220703125, + 21421.421875, + 21621.62109375, + 21821.822265625, + 22022.021484375, + 22222.22265625, + 22422.421875, + 22622.623046875, + 22822.822265625, + 23023.0234375, + 23223.22265625, + 23423.423828125, + 23623.623046875, + 23823.82421875, + 24024.0234375, + 24224.224609375, + 24424.423828125, + 24624.625, + 24824.82421875, + 25025.025390625, + 25225.224609375, + 25425.42578125, + 25625.625, + 25825.826171875, + 26026.025390625, + 26226.2265625, + 26426.42578125, + 26626.626953125, + 26826.826171875, + 27027.02734375, + 27227.2265625, + 27427.427734375, + 27627.626953125, + 27827.828125, + 28028.02734375, + 28228.228515625, + 28428.427734375, + 28628.62890625, + 28828.828125, + 29029.029296875, + 29229.228515625, + 29429.4296875, + 29629.62890625, + 29829.830078125, + 30030.029296875, + 30230.23046875, + 30430.4296875, + 30630.630859375, + 30830.830078125, + 31031.03125, + 31231.23046875, + 31431.431640625, + 31631.630859375, + 31831.83203125, + 32032.03125, + 32232.232421875, + 32432.431640625, + 32632.6328125, + 32832.83203125, + 33033.03125, + 33233.234375, + 33433.43359375, + 33633.6328125, + 33833.83203125, + 34034.03515625, + 34234.234375, + 34434.43359375, + 34634.6328125, + 34834.8359375, + 35035.03515625, + 35235.234375, + 35435.43359375, + 35635.63671875, + 35835.8359375, + 36036.03515625, + 36236.234375, + 36436.4375, + 36636.63671875, + 36836.8359375, + 37037.03515625, + 37237.23828125, + 37437.4375, + 37637.63671875, + 37837.8359375, + 38038.0390625, + 38238.23828125, + 38438.4375, + 38638.63671875, + 38838.83984375, + 39039.0390625, + 39239.23828125, + 39439.4375, + 39639.640625, + 39839.83984375, + 40040.0390625, + 40240.2421875, + 40440.44140625, + 40640.640625, + 40840.83984375, + 41041.04296875, + 41241.2421875, + 41441.44140625, + 41641.640625, + 41841.84375, + 42042.04296875, + 42242.2421875, + 42442.44140625, + 42642.64453125, + 42842.84375, + 43043.04296875, + 43243.2421875, + 43443.4453125, + 43643.64453125, + 43843.84375, + 44044.04296875, + 44244.24609375, + 44444.4453125, + 44644.64453125, + 44844.84375, + 45045.046875, + 45245.24609375, + 45445.4453125, + 45645.64453125, + 45845.84765625, + 46046.046875, + 46246.24609375, + 46446.4453125, + 46646.6484375, + 46846.84765625, + 47047.046875, + 47247.24609375, + 47447.44921875, + 47647.6484375, + 47847.84765625, + 48048.046875, + 48248.25, + 48448.44921875, + 48648.6484375, + 48848.84765625, + 49049.05078125, + 49249.25, + 49449.44921875, + 49649.6484375, + 49849.8515625, + 50050.05078125, + 50250.25, + 50450.44921875, + 50650.65234375, + 50850.8515625, + 51051.05078125, + 51251.25, + 51451.453125, + 51651.65234375, + 51851.8515625, + 52052.05078125, + 52252.25390625, + 52452.453125, + 52652.65234375, + 52852.8515625, + 53053.0546875, + 53253.25390625, + 53453.453125, + 53653.65234375, + 53853.85546875, + 54054.0546875, + 54254.25390625, + 54454.453125, + 54654.65625, + 54854.85546875, + 55055.0546875, + 55255.25390625, + 55455.45703125, + 55655.65625, + 55855.85546875, + 56056.0546875, + 56256.2578125, + 56456.45703125, + 56656.65625, + 56856.85546875, + 57057.05859375, + 57257.2578125, + 57457.45703125, + 57657.65625, + 57857.859375, + 58058.05859375, + 58258.2578125, + 58458.45703125, + 58658.66015625, + 58858.859375, + 59059.05859375, + 59259.2578125, + 59459.4609375, + 59659.66015625, + 59859.859375, + 60060.05859375, + 60260.26171875, + 60460.4609375, + 60660.66015625, + 60860.859375, + 61061.0625, + 61261.26171875, + 61461.4609375, + 61661.66015625, + 61861.86328125, + 62062.0625, + 62262.26171875, + 62462.4609375, + 62662.6640625, + 62862.86328125, + 63063.0625, + 63263.26171875, + 63463.46484375, + 63663.6640625, + 63863.86328125, + 64064.0625, + 64264.265625, + 64464.46484375, + 64664.6640625, + 64864.86328125, + 65065.06640625, + 65265.265625, + 65465.46484375, + 65665.6640625, + 65865.8671875, + 66066.0625, + 66266.265625, + 66466.46875, + 66666.6640625, + 66866.8671875, + 67067.0703125, + 67267.265625, + 67467.46875, + 67667.6640625, + 67867.8671875, + 68068.0703125, + 68268.265625, + 68468.46875, + 68668.671875, + 68868.8671875, + 69069.0703125, + 69269.265625, + 69469.46875, + 69669.671875, + 69869.8671875, + 70070.0703125, + 70270.2734375, + 70470.46875, + 70670.671875, + 70870.8671875, + 71071.0703125, + 71271.2734375, + 71471.46875, + 71671.671875, + 71871.875, + 72072.0703125, + 72272.2734375, + 72472.46875, + 72672.671875, + 72872.875, + 73073.0703125, + 73273.2734375, + 73473.4765625, + 73673.671875, + 73873.875, + 74074.0703125, + 74274.2734375, + 74474.4765625, + 74674.671875, + 74874.875, + 75075.078125, + 75275.2734375, + 75475.4765625, + 75675.671875, + 75875.875, + 76076.078125, + 76276.2734375, + 76476.4765625, + 76676.6796875, + 76876.875, + 77077.078125, + 77277.2734375, + 77477.4765625, + 77677.6796875, + 77877.875, + 78078.078125, + 78278.28125, + 78478.4765625, + 78678.6796875, + 78878.875, + 79079.078125, + 79279.28125, + 79479.4765625, + 79679.6796875, + 79879.8828125, + 80080.078125, + 80280.28125, + 80480.484375, + 80680.6796875, + 80880.8828125, + 81081.078125, + 81281.28125, + 81481.484375, + 81681.6796875, + 81881.8828125, + 82082.0859375, + 82282.28125, + 82482.484375, + 82682.6796875, + 82882.8828125, + 83083.0859375, + 83283.28125, + 83483.484375, + 83683.6875, + 83883.8828125, + 84084.0859375, + 84284.28125, + 84484.484375, + 84684.6875, + 84884.8828125, + 85085.0859375, + 85285.2890625, + 85485.484375, + 85685.6875, + 85885.8828125, + 86086.0859375, + 86286.2890625, + 86486.484375, + 86686.6875, + 86886.890625, + 87087.0859375, + 87287.2890625, + 87487.484375, + 87687.6875, + 87887.890625, + 88088.0859375, + 88288.2890625, + 88488.4921875, + 88688.6875, + 88888.890625, + 89089.0859375, + 89289.2890625, + 89489.4921875, + 89689.6875, + 89889.890625, + 90090.09375, + 90290.2890625, + 90490.4921875, + 90690.6875, + 90890.890625, + 91091.09375, + 91291.2890625, + 91491.4921875, + 91691.6953125, + 91891.890625, + 92092.09375, + 92292.2890625, + 92492.4921875, + 92692.6953125, + 92892.890625, + 93093.09375, + 93293.296875, + 93493.4921875, + 93693.6953125, + 93893.890625, + 94094.09375, + 94294.296875, + 94494.4921875, + 94694.6953125, + 94894.8984375, + 95095.09375, + 95295.296875, + 95495.4921875, + 95695.6953125, + 95895.8984375, + 96096.09375, + 96296.296875, + 96496.5, + 96696.6953125, + 96896.8984375, + 97097.09375, + 97297.296875, + 97497.5, + 97697.6953125, + 97897.8984375, + 98098.1015625, + 98298.296875, + 98498.5, + 98698.6953125, + 98898.8984375, + 99099.1015625, + 99299.296875, + 99499.5, + 99699.703125, + 99899.8984375, + 100100.1015625, + 100300.296875, + 100500.5, + 100700.703125, + 100900.8984375, + 101101.1015625, + 101301.3046875, + 101501.5, + 101701.703125, + 101901.8984375, + 102102.1015625, + 102302.3046875, + 102502.5, + 102702.703125, + 102902.90625, + 103103.1015625, + 103303.3046875, + 103503.5, + 103703.703125, + 103903.90625, + 104104.1015625, + 104304.3046875, + 104504.5078125, + 104704.703125, + 104904.90625, + 105105.1015625, + 105305.3046875, + 105505.5078125, + 105705.703125, + 105905.90625, + 106106.109375, + 106306.3046875, + 106506.5078125, + 106706.703125, + 106906.90625, + 107107.109375, + 107307.3046875, + 107507.5078125, + 107707.7109375, + 107907.90625, + 108108.109375, + 108308.3046875, + 108508.5078125, + 108708.7109375, + 108908.90625, + 109109.109375, + 109309.3125, + 109509.5078125, + 109709.7109375, + 109909.90625, + 110110.109375, + 110310.3125, + 110510.5078125, + 110710.7109375, + 110910.9140625, + 111111.109375, + 111311.3125, + 111511.5078125, + 111711.7109375, + 111911.9140625, + 112112.109375, + 112312.3125, + 112512.515625, + 112712.7109375, + 112912.9140625, + 113113.109375, + 113313.3125, + 113513.515625, + 113713.7109375, + 113913.9140625, + 114114.1171875, + 114314.3125, + 114514.515625, + 114714.7109375, + 114914.9140625, + 115115.1171875, + 115315.3125, + 115515.515625, + 115715.71875, + 115915.9140625, + 116116.1171875, + 116316.3125, + 116516.515625, + 116716.71875, + 116916.9140625, + 117117.1171875, + 117317.3203125, + 117517.515625, + 117717.71875, + 117917.9140625, + 118118.1171875, + 118318.3203125, + 118518.515625, + 118718.71875, + 118918.921875, + 119119.1171875, + 119319.3203125, + 119519.515625, + 119719.71875, + 119919.921875, + 120120.1171875, + 120320.3203125, + 120520.5234375, + 120720.71875, + 120920.921875, + 121121.125, + 121321.3203125, + 121521.5234375, + 121721.71875, + 121921.921875, + 122122.125, + 122322.3203125, + 122522.5234375, + 122722.7265625, + 122922.921875, + 123123.125, + 123323.3203125, + 123523.5234375, + 123723.7265625, + 123923.921875, + 124124.125, + 124324.328125, + 124524.5234375, + 124724.7265625, + 124924.921875, + 125125.125, + 125325.328125, + 125525.5234375, + 125725.7265625, + 125925.9296875, + 126126.125, + 126326.328125, + 126526.5234375, + 126726.7265625, + 126926.9296875, + 127127.125, + 127327.328125, + 127527.53125, + 127727.7265625, + 127927.9296875, + 128128.125, + 128328.328125, + 128528.53125, + 128728.7265625, + 128928.9296875, + 129129.1328125, + 129329.328125, + 129529.53125, + 129729.7265625, + 129929.9296875, + 130130.1328125, + 130330.328125, + 130530.53125, + 130730.734375, + 130930.9296875, + 131131.125, + 131331.328125, + 131531.53125, + 131731.734375, + 131931.9375, + 132132.125, + 132332.328125, + 132532.53125, + 132732.734375, + 132932.9375, + 133133.140625, + 133333.328125, + 133533.53125, + 133733.734375, + 133933.9375, + 134134.140625, + 134334.328125, + 134534.53125, + 134734.734375, + 134934.9375, + 135135.140625, + 135335.328125, + 135535.53125, + 135735.734375, + 135935.9375, + 136136.140625, + 136336.34375, + 136536.53125, + 136736.734375, + 136936.9375, + 137137.140625, + 137337.34375, + 137537.53125, + 137737.734375, + 137937.9375, + 138138.140625, + 138338.34375, + 138538.53125, + 138738.734375, + 138938.9375, + 139139.140625, + 139339.34375, + 139539.546875, + 139739.734375, + 139939.9375, + 140140.140625, + 140340.34375, + 140540.546875, + 140740.734375, + 140940.9375, + 141141.140625, + 141341.34375, + 141541.546875, + 141741.734375, + 141941.9375, + 142142.140625, + 142342.34375, + 142542.546875, + 142742.75, + 142942.9375, + 143143.140625, + 143343.34375, + 143543.546875, + 143743.75, + 143943.9375, + 144144.140625, + 144344.34375, + 144544.546875, + 144744.75, + 144944.9375, + 145145.140625, + 145345.34375, + 145545.546875, + 145745.75, + 145945.953125, + 146146.140625, + 146346.34375, + 146546.546875, + 146746.75, + 146946.953125, + 147147.140625, + 147347.34375, + 147547.546875, + 147747.75, + 147947.953125, + 148148.140625, + 148348.34375, + 148548.546875, + 148748.75, + 148948.953125, + 149149.15625, + 149349.34375, + 149549.546875, + 149749.75, + 149949.953125, + 150150.15625, + 150350.34375, + 150550.546875, + 150750.75, + 150950.953125, + 151151.15625, + 151351.34375, + 151551.546875, + 151751.75, + 151951.953125, + 152152.15625, + 152352.359375, + 152552.546875, + 152752.75, + 152952.953125, + 153153.15625, + 153353.359375, + 153553.546875, + 153753.75, + 153953.953125, + 154154.15625, + 154354.359375, + 154554.546875, + 154754.75, + 154954.953125, + 155155.15625, + 155355.359375, + 155555.5625, + 155755.75, + 155955.953125, + 156156.15625, + 156356.359375, + 156556.5625, + 156756.75, + 156956.953125, + 157157.15625, + 157357.359375, + 157557.5625, + 157757.75, + 157957.953125, + 158158.15625, + 158358.359375, + 158558.5625, + 158758.765625, + 158958.953125, + 159159.15625, + 159359.359375, + 159559.5625, + 159759.765625, + 159959.953125, + 160160.15625, + 160360.359375, + 160560.5625, + 160760.765625, + 160960.96875, + 161161.15625, + 161361.359375, + 161561.5625, + 161761.765625, + 161961.96875, + 162162.15625, + 162362.359375, + 162562.5625, + 162762.765625, + 162962.96875, + 163163.15625, + 163363.359375, + 163563.5625, + 163763.765625, + 163963.96875, + 164164.171875, + 164364.359375, + 164564.5625, + 164764.765625, + 164964.96875, + 165165.171875, + 165365.359375, + 165565.5625, + 165765.765625, + 165965.96875, + 166166.171875, + 166366.359375, + 166566.5625, + 166766.765625, + 166966.96875, + 167167.171875, + 167367.375, + 167567.5625, + 167767.765625, + 167967.96875, + 168168.171875, + 168368.375, + 168568.5625, + 168768.765625, + 168968.96875, + 169169.171875, + 169369.375, + 169569.5625, + 169769.765625, + 169969.96875, + 170170.171875, + 170370.375, + 170570.578125, + 170770.765625, + 170970.96875, + 171171.171875, + 171371.375, + 171571.578125, + 171771.765625, + 171971.96875, + 172172.171875, + 172372.375, + 172572.578125, + 172772.765625, + 172972.96875, + 173173.171875, + 173373.375, + 173573.578125, + 173773.78125, + 173973.96875, + 174174.171875, + 174374.375, + 174574.578125, + 174774.78125, + 174974.96875, + 175175.171875, + 175375.375, + 175575.578125, + 175775.78125, + 175975.96875, + 176176.171875, + 176376.375, + 176576.578125, + 176776.78125, + 176976.984375, + 177177.171875, + 177377.375, + 177577.578125, + 177777.78125, + 177977.984375, + 178178.171875, + 178378.375, + 178578.578125, + 178778.78125, + 178978.984375, + 179179.171875, + 179379.375, + 179579.578125, + 179779.78125, + 179979.984375, + 180180.1875, + 180380.375, + 180580.578125, + 180780.78125, + 180980.984375, + 181181.1875, + 181381.375, + 181581.578125, + 181781.78125, + 181981.984375, + 182182.1875, + 182382.375, + 182582.578125, + 182782.78125, + 182982.984375, + 183183.1875, + 183383.390625, + 183583.578125, + 183783.78125, + 183983.984375, + 184184.1875, + 184384.390625, + 184584.578125, + 184784.78125, + 184984.984375, + 185185.1875, + 185385.390625, + 185585.578125, + 185785.78125, + 185985.984375, + 186186.1875, + 186386.390625, + 186586.59375, + 186786.78125, + 186986.984375, + 187187.1875, + 187387.390625, + 187587.59375, + 187787.78125, + 187987.984375, + 188188.1875, + 188388.390625, + 188588.59375, + 188788.78125, + 188988.984375, + 189189.1875, + 189389.390625, + 189589.59375, + 189789.796875, + 189989.984375, + 190190.1875, + 190390.390625, + 190590.59375, + 190790.796875, + 190990.984375, + 191191.1875, + 191391.390625, + 191591.59375, + 191791.796875, + 191991.984375, + 192192.1875, + 192392.390625, + 192592.59375, + 192792.796875, + 192993, + 193193.1875, + 193393.390625, + 193593.59375, + 193793.796875, + 193994, + 194194.1875, + 194394.390625, + 194594.59375, + 194794.796875, + 194995, + 195195.1875, + 195395.390625, + 195595.59375, + 195795.796875, + 195996, + 196196.203125, + 196396.390625, + 196596.59375, + 196796.796875, + 196997, + 197197.203125, + 197397.390625, + 197597.59375, + 197797.796875, + 197998, + 198198.203125, + 198398.390625, + 198598.59375, + 198798.796875, + 198999, + 199199.203125, + 199399.40625, + 199599.59375, + 199799.796875, + 200000 + ], + "xaxis": "x", + "y": [ + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 600, + 643.060546875, + 693.1103515625, + 743.1611328125, + 793.2109375, + 843.2607421875, + 893.310546875, + 943.361328125, + 993.4111328125, + 1043.4609375, + 1093.5107421875, + 1143.5615234375, + 1193.611328125, + 1243.6611328125, + 1293.7109375, + 1343.76171875, + 1393.8115234375, + 1443.861328125, + 1493.9111328125, + 1543.9619140625, + 1594.01171875, + 1644.0615234375, + 1694.111328125, + 1744.162109375, + 1794.2119140625, + 1844.26171875, + 1894.3115234375, + 1944.3623046875, + 1994.412109375, + 2044.4619140625, + 2094.51171875, + 2144.5625, + 2194.6123046875, + 2244.662109375, + 2294.7119140625, + 2344.7626953125, + 2394.8125, + 2444.8623046875, + 2494.912109375, + 2544.962890625, + 2595.0126953125, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2600, + 2607.9599609375, + 2619.171142578125, + 2630.382568359375, + 2641.593994140625, + 2652.804443359375, + 2664.015869140625, + 2675.227294921875, + 2686.438720703125, + 2697.64990234375, + 2708.860595703125, + 2720.07177734375, + 2731.283203125, + 2742.49462890625, + 2753.7060546875, + 2764.91650390625, + 2776.1279296875, + 2787.33935546875, + 2798.550537109375, + 2809.761962890625, + 2820.973388671875, + 2832.183837890625, + 2843.395263671875, + 2854.606689453125, + 2865.818115234375, + 2877.029296875, + 2888.239990234375, + 2899.451171875, + 2910.66259765625, + 2921.8740234375, + 2933.08544921875, + 2944.2958984375, + 2955.50732421875, + 2966.718505859375, + 2977.929931640625, + 2989.141357421875, + 3000.352783203125, + 3011.563232421875, + 3022.774658203125, + 3033.986083984375, + 3045.197265625, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048, + 3048 + ], + "yaxis": "y" + } + ], + "layout": { + "font": { + "color": "black", + "family": "Roboto Serif" + }, + "height": 600, + "images": [ + { + "sizex": 0.2, + "sizey": 0.2, + "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", + "x": 1, + "xanchor": "right", + "xref": "paper", + "y": -0.15, + "yanchor": "bottom", + "yref": "paper" + } + ], + "legend": { + "title": { + "text": "Tax type" + }, + "tracegroupgap": 0 + }, + "modebar": { + "bgcolor": "rgba(0,0,0,0)", + "color": "rgba(0,0,0,0)" + }, + "template": { + "data": { + "bar": [ + { + "error_x": { + "color": "#2a3f5f" + }, + "error_y": { + "color": "#2a3f5f" + }, + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "barpolar": [ + { + "marker": { + "line": { + "color": "white", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "baxis": { + "endlinecolor": "#2a3f5f", + "gridcolor": "#C8D4E3", + "linecolor": "#C8D4E3", + "minorgridcolor": "#C8D4E3", + "startlinecolor": "#2a3f5f" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter": [ + { + "fillpattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + }, + "type": "scatter" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#EBF0F8" + }, + "line": { + "color": "white" + } + }, + "header": { + "fill": { + "color": "#C8D4E3" + }, + "line": { + "color": "white" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#2a3f5f", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#2a3f5f" + }, + "geo": { + "bgcolor": "white", + "lakecolor": "white", + "landcolor": "white", + "showlakes": true, + "showland": true, + "subunitcolor": "#C8D4E3" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "light" + }, + "paper_bgcolor": "white", + "plot_bgcolor": "white", + "polar": { + "angularaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + }, + "bgcolor": "white", + "radialaxis": { + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "yaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + }, + "zaxis": { + "backgroundcolor": "white", + "gridcolor": "#DFE8F3", + "gridwidth": 2, + "linecolor": "#EBF0F8", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#EBF0F8" + } + }, + "shapedefaults": { + "line": { + "color": "#2a3f5f" + } + }, + "ternary": { + "aaxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "baxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + }, + "bgcolor": "white", + "caxis": { + "gridcolor": "#DFE8F3", + "linecolor": "#A2B1C6", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#EBF0F8", + "linecolor": "#EBF0F8", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#EBF0F8", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Income tax vs employment income" + }, + "width": 800, + "xaxis": { + "anchor": "y", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Employment income" + } + }, + "yaxis": { + "anchor": "x", + "domain": [ + 0, + 1 + ], + "title": { + "text": "Income tax (£)" + } + } + } + } + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from policyengine_uk import Simulation\n", + "\n", + "simulation = Simulation(\n", + " situation=dict(\n", + " people=dict(\n", + " person=dict(\n", + " age=30,\n", + " dividend_income=10_000,\n", + " )\n", + " ),\n", + " axes=[[\n", + " dict(\n", + " name=\"employment_income\",\n", + " min=0,\n", + " max=200_000,\n", + " count=1_000,\n", + " )\n", + " ]]\n", + " ),\n", + ")\n", + "\n", + "import plotly.express as px\n", + "import pandas as pd\n", + "from policyengine_core.charts import format_fig\n", + "\n", + "df = pd.DataFrame({\n", + " \"Employment income\": simulation.calculate(\"employment_income\"),\n", + " \"Income tax\": simulation.calculate(\"income_tax\"),\n", + " \"Dividend income tax\": simulation.calculate(\"dividend_income_tax\"),\n", + "})\n", + "\n", + "fig = px.line(\n", + " df,\n", + " x=\"Employment income\",\n", + " y=[\"Income tax\", \"Dividend income tax\"],\n", + " title=\"Income tax vs employment income\",\n", + " labels={\n", + " \"value\": \"Income tax (£)\",\n", + " \"variable\": \"Tax type\",\n", + " },\n", + ")\n", + "\n", + "format_fig(fig)" + ] } ], "metadata": { From 46c6a061d3907b12a7077dddb8e26aeb5a0d7cb5 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 12 Oct 2023 08:58:15 -0400 Subject: [PATCH 12/20] revise --- docs/book/programs/gov/hmrc/income-tax.ipynb | 511 ------------------- 1 file changed, 511 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index 7b91c2312..a5a5be3ec 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -21,21 +21,13 @@ "These are specific amounts of income that individuals can earn before they are required to pay income tax. Various types of allowances exist, such as Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance, each offering different benefits and eligibility criteria.\n", "\n", "- Tax Charges:\n", -<<<<<<< HEAD "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These charges fluctuate based on income levels and are influenced by additional factors, such as the High-Income Child Benefit Charge.\n", -======= - "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These liabilities ensure that individuals contribute a fair amount to the national revenue, with the charges varying depending on the level of income and other factors like the High-Income Child Benefit Charge.\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "\n", "- Tax Rates:\n", "The government applies different percentages of tax rates based on the income bracket an individual falls into. There are Basic, Higher, and Additional rates, each applicable to respective income ranges. Moreover, specific types of income, like dividends, have their distinct tax rates.\n", "\n", "- Tax Reliefs:\n", -<<<<<<< HEAD "To promote certain behaviors or lower the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" -======= - "To promote certain behaviors or ease the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -84,11 +76,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 5, -======= - "execution_count": 10, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -122,20 +110,15 @@ " Person\n", " Employment Income (£)\n", " Dividend Income (£)\n", -<<<<<<< HEAD " Savings Interest Income (£)\n", " Income Tax (£)\n", " Dividend Income Tax (£)\n", " Savings Income Tax (£)\n", -======= - " Income Tax (£)\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Person1\n", " 50000\n", " 10000\n", @@ -183,47 +166,12 @@ " 45360.0\n", " 9100.0\n", " 7800.0\n", -======= - " Person 1\n", - " 50000\n", - " 10000\n", - " 10068.5\n", - " \n", - " \n", - " 1\n", - " Person 2\n", - " 60000\n", - " 15000\n", - " 15657.0\n", - " \n", - " \n", - " 2\n", - " Person 3\n", - " 70000\n", - " 20000\n", - " 21282.0\n", - " \n", - " \n", - " 3\n", - " Person 4\n", - " 80000\n", - " 25000\n", - " 27907.0\n", - " \n", - " \n", - " 4\n", - " Person 5\n", - " 90000\n", - " 30000\n", - " 36532.0\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Person Employment Income (£) Dividend Income (£) \\\n", "0 Person1 50000 10000 \n", "1 Person2 60000 15000 \n", @@ -247,48 +195,26 @@ ] }, "execution_count": 5, -======= - " Person Employment Income (£) Dividend Income (£) Income Tax (£)\n", - "0 Person 1 50000 10000 10068.5\n", - "1 Person 2 60000 15000 15657.0\n", - "2 Person 3 70000 20000 21282.0\n", - "3 Person 4 80000 25000 27907.0\n", - "4 Person 5 90000 30000 36532.0" - ] - }, - "execution_count": 10, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", -<<<<<<< HEAD "from policyengine_uk import Simulation\n", "\n", "def calculate_taxes(employment_income, dividend_income, savings_interest_income):\n", -======= - "\n", - "from policyengine_uk import Simulation\n", - "\n", - "def calculate_income_tax(employment_income, dividend_income):\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " simulation = Simulation(\n", " situation={\n", " \"people\": {\n", " \"person\": {\n", " \"employment_income\": employment_income,\n", " \"dividend_income\": dividend_income,\n", -<<<<<<< HEAD " \"savings_interest_income\": savings_interest_income\n", -======= ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " }\n", " }\n", " }\n", " )\n", -<<<<<<< HEAD " income_tax = simulation.calculate(\"income_tax\")[0]\n", " dividend_income_tax = simulation.calculate(\"dividend_income_tax\")[0] # Added\n", " savings_income_tax = simulation.calculate(\"savings_income_tax\")[0] # Added\n", @@ -313,23 +239,6 @@ "\n", "df = pd.DataFrame(data)\n", "df" -======= - " return simulation.calculate(\"income_tax\")[0] \n", - "\n", - "data = {\n", - " \"Person\": [\"Person 1\", \"Person 2\", \"Person 3\", \"Person 4\", \"Person 5\"],\n", - " \"Employment Income (£)\": [50000, 60000, 70000, 80000, 90000],\n", - " \"Dividend Income (£)\": [10000, 15000, 20000, 25000, 30000],\n", - " \"Income Tax (£)\": []\n", - "}\n", - "\n", - "for emp_income, div_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"]):\n", - " data[\"Income Tax (£)\"].append(calculate_income_tax(emp_income, div_income))\n", - "\n", - "df = pd.DataFrame(data)\n", - "df\n", - "\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -354,11 +263,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 68, -======= - "execution_count": 17, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -389,21 +294,14 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Default\n", " 40000.0\n", " 2015-06-01\n", @@ -425,36 +323,12 @@ " Taper\n", " 240000.0\n", " 2015-06-01\n", -======= - " default\n", - " 2015-06-01: 40,000\n", - " currency-GBP\n", - " \n", - " \n", - " 1\n", - " minimum\n", - " 2015-06-01: 4,000\n", - " currency-GBP\n", - " \n", - " \n", - " 2\n", - " reduction_rate\n", - " 2015-06-01: 0.5\n", - " marginal-rate\n", - " \n", - " \n", - " 3\n", - " taper\n", - " 2015-06-01: 240,000\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Default 40000.0 2015-06-01\n", "1 Minimum 4000.0 2015-06-01\n", @@ -463,22 +337,11 @@ ] }, "execution_count": 68, -======= - " Name Value Unit\n", - "0 default 2015-06-01: 40,000 currency-GBP\n", - "1 minimum 2015-06-01: 4,000 currency-GBP\n", - "2 reduction_rate 2015-06-01: 0.5 marginal-rate\n", - "3 taper 2015-06-01: 240,000 currency-GBP" - ] - }, - "execution_count": 17, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "from policyengine_uk.system import system\n", "import pandas as pd\n", "\n", @@ -505,36 +368,6 @@ "\n", "df = pd.DataFrame(data)\n", "df" -======= - "annual_allowance_data = [\n", - " {\n", - " \"Name\": \"default\",\n", - " \"Value\": \"2015-06-01: 40,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - "\n", - " {\n", - " \"Name\": \"minimum\",\n", - " \"Value\": \"2015-06-01: 4,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - "\n", - " {\n", - " \"Name\": \"reduction_rate\",\n", - " \"Value\": \"2015-06-01: 0.5\",\n", - " \"Unit\": \"marginal-rate\"\n", - "\n", - " },\n", - " {\n", - " \"Name\": \"taper\",\n", - " \"Value\": \"2015-06-01: 240,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(annual_allowance_data)\n", - "df\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -548,11 +381,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 69, -======= - "execution_count": 20, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -583,21 +412,14 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Max\n", " 0.1\n", " 2016-04-01\n", @@ -613,30 +435,12 @@ " Takeup Rate\n", " 1.0\n", " 2000-01-01\n", -======= - " max\n", - " 2016-04-01: 0.1\n", - " /1\n", - " \n", - " \n", - " 1\n", - " rounding_increment\n", - " 2016-04-01: 10\n", - " currency-GBP\n", - " \n", - " \n", - " 2\n", - " takeup_rate\n", - " 2000-01-01: 1\n", - " /1\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Max 0.1 2016-04-01\n", "1 Rounding Increment 10.0 2016-04-01\n", @@ -644,21 +448,11 @@ ] }, "execution_count": 69, -======= - " Name Value Unit\n", - "0 max 2016-04-01: 0.1 /1\n", - "1 rounding_increment 2016-04-01: 10 currency-GBP\n", - "2 takeup_rate 2000-01-01: 1 /1" - ] - }, - "execution_count": 20, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "max = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.max\n", "rounding_increment = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", "takeup_rate = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.takeup_rate\n", @@ -678,29 +472,6 @@ "}\n", "df = pd.DataFrame(data)\n", "df" -======= - "marriage_allowance_data = [\n", - " {\n", - " \"Name\": \"max\",\n", - " \"Value\": \"2016-04-01: 0.1\",\n", - " \"Unit\": \"/1\"\n", - " },\n", - " {\n", - " \"Name\": \"rounding_increment\",\n", - " \"Value\": \"2016-04-01: 10\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"takeup_rate\",\n", - " \"Value\": \"2000-01-01: 1\",\n", - " \"Unit\": \"/1\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(marriage_allowance_data)\n", - "df\n", - "\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -714,11 +485,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 70, -======= - "execution_count": 25, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "colab": { "base_uri": "https://localhost:8080/" @@ -748,54 +515,33 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Deduction Rate\n", " 0.1\n", " 2010-01-01\n", -======= - " deduction_rate\n", - " 2010-01-01: 10%\n", - " /1\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Deduction Rate 0.1 2010-01-01" ] }, "execution_count": 70, -======= - " Name Value Unit\n", - "0 deduction_rate 2010-01-01: 10% /1" - ] - }, - "execution_count": 25, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", "\n", "data = {\n", @@ -808,17 +554,6 @@ " ]\n", "}\n", "df = pd.DataFrame(data)\n", -======= - "married_couples_allowance_data = [\n", - " {\n", - " \"Name\": \"deduction_rate\",\n", - " \"Value\": \"2010-01-01: 10%\",\n", - " \"Unit\": \"/1\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(married_couples_allowance_data)\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "df\n", "\n" ] @@ -834,11 +569,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 71, -======= - "execution_count": 28, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -870,20 +601,13 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Personal Allowance Amount (£)\n", " Effective Date\n", -======= - " Date\n", - " Allowance Amount\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " 12570\n", " 2025-04-06\n", " \n", @@ -911,48 +635,12 @@ " 5\n", " 10600\n", " 2015-04-06\n", -======= - " 2015-04-06\n", - " 10600\n", - " currency-GBP\n", - " \n", - " \n", - " 1\n", - " 2017-04-06\n", - " 11500\n", - " currency-GBP\n", - " \n", - " \n", - " 2\n", - " 2018-04-06\n", - " 11850\n", - " currency-GBP\n", - " \n", - " \n", - " 3\n", - " 2019-04-06\n", - " 12500\n", - " currency-GBP\n", - " \n", - " \n", - " 4\n", - " 2021-04-06\n", - " 12570\n", - " currency-GBP\n", - " \n", - " \n", - " 5\n", - " 2025-04-06\n", - " 12570\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Personal Allowance Amount (£) Effective Date\n", "0 12570 2025-04-06\n", "1 12570 2021-04-06\n", @@ -963,24 +651,11 @@ ] }, "execution_count": 71, -======= - " Date Allowance Amount Unit\n", - "0 2015-04-06 10600 currency-GBP\n", - "1 2017-04-06 11500 currency-GBP\n", - "2 2018-04-06 11850 currency-GBP\n", - "3 2019-04-06 12500 currency-GBP\n", - "4 2021-04-06 12570 currency-GBP\n", - "5 2025-04-06 12570 currency-GBP" - ] - }, - "execution_count": 28, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", "\n", "values = [item.value for item in amount.values_list]\n", @@ -990,15 +665,6 @@ "df = pd.DataFrame({\n", " \"Personal Allowance Amount (£)\": values, \n", " \"Effective Date\": dates\n", -======= - "dates = ['2015-04-06', '2017-04-06', '2018-04-06', '2019-04-06', '2021-04-06', '2025-04-06']\n", - "values = [10600, 11500, 11850, 12500, 12570, 12570]\n", - "\n", - "df = pd.DataFrame({\n", - " 'Date': dates,\n", - " 'Allowance Amount': values,\n", - " 'Unit': \"currency-GBP\"\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "})\n", "\n", "df\n", @@ -1016,11 +682,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 72, -======= - "execution_count": 29, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -1051,21 +713,14 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Addtional Threshold\n", " 0\n", " 2005-06-01\n", @@ -1081,30 +736,12 @@ " Higher Threshold\n", " 500\n", " 2005-06-01\n", -======= - " additional threshold\n", - " 2005-06-01: 0\n", - " currency-GBP\n", - " \n", - " \n", - " 1\n", - " basic threshold\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", - " \n", - " \n", - " 2\n", - " higher threshold\n", - " 2005-06-01: 500\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Addtional Threshold 0 2005-06-01\n", "1 Basic Threshold 1000 2005-06-01\n", @@ -1112,21 +749,11 @@ ] }, "execution_count": 72, -======= - " Name Value Unit\n", - "0 additional threshold 2005-06-01: 0 currency-GBP\n", - "1 basic threshold 2005-06-01: 1,000 currency-GBP\n", - "2 higher threshold 2005-06-01: 500 currency-GBP" - ] - }, - "execution_count": 29, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "addtional_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", "basic_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.basic\n", "higher_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.higher\n", @@ -1146,30 +773,6 @@ "}\n", "df = pd.DataFrame(data)\n", "df" -======= - "personal_savings_allowance_data = [\n", - " {\n", - " \"Name\": \"additional threshold\",\n", - " \"Value\": \"2005-06-01: 0\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"basic threshold\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " },\n", - " {\n", - " \"Name\": \"higher threshold\",\n", - " \"Value\": \"2005-06-01: 500\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(personal_savings_allowance_data)\n", - "df\n", - "\n", - "\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -1183,11 +786,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 73, -======= - "execution_count": 30, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -1218,54 +817,33 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Dividend Allowance\n", " 2000\n", " 2015-06-05\n", -======= - " dividend_allowance\n", - " 2015-06-05: 2,000\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Dividend Allowance 2000 2015-06-05" ] }, "execution_count": 73, -======= - " Name Value Unit\n", - "0 dividend_allowance 2015-06-05: 2,000 currency-GBP" - ] - }, - "execution_count": 30, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", "\n", "data = {\n", @@ -1278,17 +856,6 @@ " ]\n", "}\n", "df = pd.DataFrame(data)\n", -======= - "dividend_allowance_data = [\n", - " {\n", - " \"Name\": \"dividend_allowance\",\n", - " \"Value\": \"2015-06-05: 2,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(dividend_allowance_data)\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "df" ] }, @@ -1303,11 +870,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 65, -======= - "execution_count": 31, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -1338,54 +901,33 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Property Allowance\n", " 1000\n", " 2005-06-01\n", -======= - " property_allowance\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Property Allowance 1000 2005-06-01" ] }, "execution_count": 65, -======= - " Name Value Unit\n", - "0 property_allowance 2005-06-01: 1,000 currency-GBP" - ] - }, - "execution_count": 31, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", "\n", "data = {\n", @@ -1399,18 +941,6 @@ "}\n", "df = pd.DataFrame(data)\n", "df" -======= - "property_allowance_data = [\n", - " {\n", - " \"Name\": \"property_allowance\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(property_allowance_data)\n", - "df\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -1424,11 +954,7 @@ }, { "cell_type": "code", -<<<<<<< HEAD "execution_count": 66, -======= - "execution_count": 33, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": { "cellView": "form", "colab": { @@ -1459,54 +985,33 @@ " \n", " \n", " \n", -<<<<<<< HEAD " Type\n", " Value\n", " Effective Date\n", -======= - " Name\n", - " Value\n", - " Unit\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", " \n", " \n", " 0\n", -<<<<<<< HEAD " Trading Allowance\n", " 1000\n", " 2005-06-01\n", -======= - " trading_allowance\n", - " 2005-06-01: 1,000\n", - " currency-GBP\n", ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 " \n", " \n", "\n", "" ], "text/plain": [ -<<<<<<< HEAD " Type Value Effective Date\n", "0 Trading Allowance 1000 2005-06-01" ] }, "execution_count": 66, -======= - " Name Value Unit\n", - "0 trading_allowance 2005-06-01: 1,000 currency-GBP" - ] - }, - "execution_count": 33, ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 "metadata": {}, "output_type": "execute_result" } ], "source": [ -<<<<<<< HEAD "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", "\n", "data = {\n", @@ -1520,19 +1025,6 @@ "}\n", "df = pd.DataFrame(data)\n", "df\n" -======= - "trading_allowance_data = [\n", - " {\n", - " \"Name\": \"trading_allowance\",\n", - " \"Value\": \"2005-06-01: 1,000\",\n", - " \"Unit\": \"currency-GBP\"\n", - " }\n", - "]\n", - "\n", - "df = pd.DataFrame(trading_allowance_data)\n", - "df\n", - "\n" ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 ] }, { @@ -1541,7 +1033,6 @@ "source": [ "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." ] -<<<<<<< HEAD }, { "cell_type": "markdown", @@ -6533,8 +6024,6 @@ "\n", "format_fig(fig)" ] -======= ->>>>>>> cae602933a4f859164e4f85944aefdf5091d1d87 } ], "metadata": { From cc1cd7c4a81d3015cd887a9f36b4a5109e495818 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 19 Oct 2023 08:46:45 -0400 Subject: [PATCH 13/20] revise --- docs/book/programs/gov/hmrc/income-tax.ipynb | 872 ++++++------------- 1 file changed, 251 insertions(+), 621 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index a5a5be3ec..a6e90994b 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -252,26 +252,10 @@ "The following tables display the parameter values for income tax allowance." ] }, - { - "cell_type": "markdown", - "metadata": { - "id": "xtGj1Z9q60Fs" - }, - "source": [ - "- Annual Allowance:" - ] - }, { "cell_type": "code", - "execution_count": 68, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "fSIiOJct5htX", - "outputId": "58536b69-9972-4e93-da3f-15643df20342" - }, + "execution_count": 74, + "metadata": {}, "outputs": [ { "data": { @@ -294,49 +278,225 @@ " \n", " \n", " \n", + " Attribute\n", " Type\n", " Value\n", " Effective Date\n", + " Unit\n", " \n", " \n", " \n", " \n", " 0\n", + " Annual Allowance\n", " Default\n", " 40000.0\n", " 2015-06-01\n", + " currency-GBP\n", " \n", " \n", " 1\n", + " Annual Allowance\n", " Minimum\n", " 4000.0\n", " 2015-06-01\n", + " currency-GBP\n", " \n", " \n", " 2\n", + " Annual Allowance\n", " Reduction Rate\n", " 0.5\n", " 2015-06-01\n", + " marginal-rate\n", " \n", " \n", " 3\n", + " Annual Allowance\n", " Taper\n", " 240000.0\n", " 2015-06-01\n", + " currency-GBP\n", + " \n", + " \n", + " 4\n", + " Marriage Allowance\n", + " Max\n", + " 0.1\n", + " 2016-04-01\n", + " /1\n", + " \n", + " \n", + " 5\n", + " Marriage Allowance\n", + " Rounding Increment\n", + " 10.0\n", + " 2016-04-01\n", + " currency-GBP\n", + " \n", + " \n", + " 6\n", + " Marriage Allowance\n", + " Takeup Rate\n", + " 1.0\n", + " 2000-01-01\n", + " /1\n", + " \n", + " \n", + " 7\n", + " Married Couples Allowance\n", + " Deduction Rate\n", + " 0.1\n", + " 2010-01-01\n", + " /1\n", + " \n", + " \n", + " 8\n", + " Personal Allowance\n", + " Amount\n", + " 12570.0\n", + " 2025-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 9\n", + " Personal Allowance\n", + " Amount\n", + " 12570.0\n", + " 2021-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 10\n", + " Personal Allowance\n", + " Amount\n", + " 12500.0\n", + " 2019-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 11\n", + " Personal Allowance\n", + " Amount\n", + " 11850.0\n", + " 2018-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 12\n", + " Personal Allowance\n", + " Amount\n", + " 11500.0\n", + " 2017-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 13\n", + " Personal Allowance\n", + " Amount\n", + " 10600.0\n", + " 2015-04-06\n", + " currency-GBP\n", + " \n", + " \n", + " 14\n", + " Personal Savings Allowance\n", + " Addtional Threshold\n", + " 0.0\n", + " 2005-06-01\n", + " currency-GBP\n", + " \n", + " \n", + " 15\n", + " Personal Savings Allowance\n", + " Basic Threshold\n", + " 1000.0\n", + " 2005-06-01\n", + " currency-GBP\n", + " \n", + " \n", + " 16\n", + " Personal Savings Allowance\n", + " Higher Threshold\n", + " 500.0\n", + " 2005-06-01\n", + " currency-GBP\n", + " \n", + " \n", + " 17\n", + " Dividend Allowance\n", + " Dividend Allowance\n", + " 2000.0\n", + " 2015-06-05\n", + " currency-GBP\n", + " \n", + " \n", + " 18\n", + " Property Allowance\n", + " Property Allowance\n", + " 1000.0\n", + " 2005-06-01\n", + " currency-GBP\n", + " \n", + " \n", + " 19\n", + " Trading Allowance\n", + " Trading Allowance\n", + " 1000.0\n", + " 2005-06-01\n", + " currency-GBP\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Type Value Effective Date\n", - "0 Default 40000.0 2015-06-01\n", - "1 Minimum 4000.0 2015-06-01\n", - "2 Reduction Rate 0.5 2015-06-01\n", - "3 Taper 240000.0 2015-06-01" + " Attribute Type Value Effective Date \\\n", + "0 Annual Allowance Default 40000.0 2015-06-01 \n", + "1 Annual Allowance Minimum 4000.0 2015-06-01 \n", + "2 Annual Allowance Reduction Rate 0.5 2015-06-01 \n", + "3 Annual Allowance Taper 240000.0 2015-06-01 \n", + "4 Marriage Allowance Max 0.1 2016-04-01 \n", + "5 Marriage Allowance Rounding Increment 10.0 2016-04-01 \n", + "6 Marriage Allowance Takeup Rate 1.0 2000-01-01 \n", + "7 Married Couples Allowance Deduction Rate 0.1 2010-01-01 \n", + "8 Personal Allowance Amount 12570.0 2025-04-06 \n", + "9 Personal Allowance Amount 12570.0 2021-04-06 \n", + "10 Personal Allowance Amount 12500.0 2019-04-06 \n", + "11 Personal Allowance Amount 11850.0 2018-04-06 \n", + "12 Personal Allowance Amount 11500.0 2017-04-06 \n", + "13 Personal Allowance Amount 10600.0 2015-04-06 \n", + "14 Personal Savings Allowance Addtional Threshold 0.0 2005-06-01 \n", + "15 Personal Savings Allowance Basic Threshold 1000.0 2005-06-01 \n", + "16 Personal Savings Allowance Higher Threshold 500.0 2005-06-01 \n", + "17 Dividend Allowance Dividend Allowance 2000.0 2015-06-05 \n", + "18 Property Allowance Property Allowance 1000.0 2005-06-01 \n", + "19 Trading Allowance Trading Allowance 1000.0 2005-06-01 \n", + "\n", + " Unit \n", + "0 currency-GBP \n", + "1 currency-GBP \n", + "2 marginal-rate \n", + "3 currency-GBP \n", + "4 /1 \n", + "5 currency-GBP \n", + "6 /1 \n", + "7 /1 \n", + "8 currency-GBP \n", + "9 currency-GBP \n", + "10 currency-GBP \n", + "11 currency-GBP \n", + "12 currency-GBP \n", + "13 currency-GBP \n", + "14 currency-GBP \n", + "15 currency-GBP \n", + "16 currency-GBP \n", + "17 currency-GBP \n", + "18 currency-GBP \n", + "19 currency-GBP " ] }, - "execution_count": 68, + "execution_count": 74, "metadata": {}, "output_type": "execute_result" } @@ -349,8 +509,8 @@ "minimum = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.minimum\n", "reduction_rate = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.reduction_rate\n", "taper = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.taper\n", - "\n", - "data = {\n", + "annual_allowance_data = {\n", + " \"Attribute\": [\"Annual Allowance\"] * 4,\n", " \"Type\": [\"Default\", \"Minimum\", \"Reduction Rate\", \"Taper\"],\n", " \"Value\": [\n", " default.values_list[-1].value,\n", @@ -363,101 +523,16 @@ " minimum.values_list[-1].instant_str,\n", " reduction_rate.values_list[-1].instant_str,\n", " taper.values_list[-1].instant_str,\n", - " ]\n", + " ],\n", + " \"Unit\": [default.metadata[\"unit\"], minimum.metadata[\"unit\"], reduction_rate.metadata[\"unit\"], taper.metadata[\"unit\"]]\n", "}\n", "\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "AqNXJHHn7CkX" - }, - "source": [ - "- Marriage Allowance" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "oxTMKHBt7BVM", - "outputId": "6188d7d5-3579-4ffa-953b-f07be019cc65" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Max0.12016-04-01
1Rounding Increment10.02016-04-01
2Takeup Rate1.02000-01-01
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Max 0.1 2016-04-01\n", - "1 Rounding Increment 10.0 2016-04-01\n", - "2 Takeup Rate 1.0 2000-01-01" - ] - }, - "execution_count": 69, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ + "\n", "max = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.max\n", "rounding_increment = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", "takeup_rate = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.takeup_rate\n", - "\n", - "data = {\n", + "marriage_allowance_data = {\n", + " \"Attribute\": [\"Marriage Allowance\"] * 3,\n", " \"Type\": [\"Max\", \"Rounding Increment\", \"Takeup Rate\"],\n", " \"Value\": [\n", " max.values_list[-1].value,\n", @@ -468,297 +543,42 @@ " max.values_list[-1].instant_str,\n", " rounding_increment.values_list[-1].instant_str,\n", " takeup_rate.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [max.metadata[\"unit\"], rounding_increment.metadata[\"unit\"], takeup_rate.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "_hc4HxX48IDd" - }, - "source": [ - "- Married Couple's Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "metadata": { - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "v2ORpQls8JrX", - "outputId": "7edb2f5e-8f19-426f-f717-9e5efe97f922" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Deduction Rate0.12010-01-01
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Deduction Rate 0.1 2010-01-01" - ] - }, - "execution_count": 70, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", "\n", - "data = {\n", + "\n", + "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", + "married_couples_allowance_data = {\n", + " \"Attribute\": [\"Married Couples Allowance\"],\n", " \"Type\": [\"Deduction Rate\"],\n", " \"Value\": [\n", " deduction_rate.values_list[-1].value\n", " ],\n", " \"Effective Date\": [\n", " deduction_rate.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [deduction_rate.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "YlRfd5rI8cm9" - }, - "source": [ - "- Personal Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 542 - }, - "id": "MeT0diTy8d5d", - "outputId": "561c3d44-cc2a-43c3-8bdc-258cd5ea34ff" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
Personal Allowance Amount (£)Effective Date
0125702025-04-06
1125702021-04-06
2125002019-04-06
3118502018-04-06
4115002017-04-06
5106002015-04-06
\n", - "
" - ], - "text/plain": [ - " Personal Allowance Amount (£) Effective Date\n", - "0 12570 2025-04-06\n", - "1 12570 2021-04-06\n", - "2 12500 2019-04-06\n", - "3 11850 2018-04-06\n", - "4 11500 2017-04-06\n", - "5 10600 2015-04-06" - ] - }, - "execution_count": 71, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", "\n", + "\n", + "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", "values = [item.value for item in amount.values_list]\n", "dates = [item.instant_str for item in amount.values_list]\n", + "personal_allowance_data = {\n", + " \"Attribute\": [\"Personal Allowance\"] * len(values),\n", + " \"Type\": [\"Amount\"] * len(values),\n", + " \"Value\": values,\n", + " \"Effective Date\": dates,\n", + " \"Unit\": [amount.metadata[\"unit\"]] * len(values)\n", + "}\n", "\n", "\n", - "df = pd.DataFrame({\n", - " \"Personal Allowance Amount (£)\": values, \n", - " \"Effective Date\": dates\n", - "})\n", - "\n", - "df\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "qmpkKy-a8-WU" - }, - "source": [ - "- Personal Savings Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "qSuYNkJi9CwG", - "outputId": "12ffcd0b-96eb-4822-a694-9939abace5ba" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Addtional Threshold02005-06-01
1Basic Threshold10002005-06-01
2Higher Threshold5002005-06-01
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Addtional Threshold 0 2005-06-01\n", - "1 Basic Threshold 1000 2005-06-01\n", - "2 Higher Threshold 500 2005-06-01" - ] - }, - "execution_count": 72, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ "addtional_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", "basic_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.basic\n", "higher_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.higher\n", - "\n", - "data = {\n", + "personal_savings_allowance_data = {\n", + " \"Attribute\": [\"Personal Savings Allowance\"] * 3,\n", " \"Type\": [\"Addtional Threshold\", \"Basic Threshold\", \"Higher Threshold\"],\n", " \"Value\": [\n", " addtional_threshold.values_list[-1].value,\n", @@ -769,262 +589,72 @@ " addtional_threshold.values_list[-1].instant_str,\n", " basic_threshold.values_list[-1].instant_str,\n", " higher_threshold.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [addtional_threshold.metadata[\"unit\"], basic_threshold.metadata[\"unit\"], higher_threshold.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "c47yF49J9eid" - }, - "source": [ - "- Dividend Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "ebCKGBSX9hmD", - "outputId": "9e4602a3-1f1c-4deb-f78c-e5d4c5793773" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Dividend Allowance20002015-06-05
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Dividend Allowance 2000 2015-06-05" - ] - }, - "execution_count": 73, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", "\n", - "data = {\n", + "\n", + "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", + "dividend_allowance_data = {\n", + " \"Attribute\": [\"Dividend Allowance\"],\n", " \"Type\": [\"Dividend Allowance\"],\n", " \"Value\": [\n", " dividend_allowance.values_list[-1].value\n", " ],\n", " \"Effective Date\": [\n", " dividend_allowance.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [dividend_allowance.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "roxvVQx6CGgJ" - }, - "source": [ - "- Property Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 65, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "49dxnShlCl8z", - "outputId": "0f6d8363-44d9-4a37-8065-7199eafac8c3" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Property Allowance10002005-06-01
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Property Allowance 1000 2005-06-01" - ] - }, - "execution_count": 65, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", "\n", - "data = {\n", + "\n", + "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", + "property_allowance_data = {\n", + " \"Attribute\": [\"Property Allowance\"],\n", " \"Type\": [\"Property Allowance\"],\n", " \"Value\": [\n", " property_allowance.values_list[-1].value\n", " ],\n", " \"Effective Date\": [\n", " property_allowance.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [property_allowance.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "SKBFVXmDCzMN" - }, - "source": [ - "- Trading Allowance:" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "CHKvIiE9C7Xh", - "outputId": "581780e5-7322-46a8-efc7-df62d1c7b24f" - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
TypeValueEffective Date
0Trading Allowance10002005-06-01
\n", - "
" - ], - "text/plain": [ - " Type Value Effective Date\n", - "0 Trading Allowance 1000 2005-06-01" - ] - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", "\n", - "data = {\n", + "\n", + "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", + "trading_allowance_data = {\n", + " \"Attribute\": [\"Trading Allowance\"],\n", " \"Type\": [\"Trading Allowance\"],\n", " \"Value\": [\n", " trading_allowance.values_list[-1].value\n", " ],\n", " \"Effective Date\": [\n", " trading_allowance.values_list[-1].instant_str\n", - " ]\n", + " ],\n", + " \"Unit\": [trading_allowance.metadata[\"unit\"]]\n", "}\n", - "df = pd.DataFrame(data)\n", - "df\n" + "\n", + "annual_allowance_df = pd.DataFrame(annual_allowance_data)\n", + "marriage_allowance_df = pd.DataFrame(marriage_allowance_data)\n", + "married_couples_allowance_df = pd.DataFrame(married_couples_allowance_data)\n", + "personal_allowance_df = pd.DataFrame(personal_allowance_data)\n", + "personal_savings_allowance_df = pd.DataFrame(personal_savings_allowance_data)\n", + "dividend_allowance_df = pd.DataFrame(dividend_allowance_data)\n", + "property_allowance_df = pd.DataFrame(property_allowance_data)\n", + "trading_allowance_df = pd.DataFrame(trading_allowance_data)\n", + "\n", + "income_tax_allowance_df = pd.concat([\n", + " annual_allowance_df,\n", + " marriage_allowance_df,\n", + " married_couples_allowance_df,\n", + " personal_allowance_df,\n", + " personal_savings_allowance_df,\n", + " dividend_allowance_df,\n", + " property_allowance_df,\n", + " trading_allowance_df\n", + "], ignore_index=True)\n", + "income_tax_allowance_df" ] }, { From 8bbebfa7d2148a579076f6f1e26d0875e37d6363 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 16 Nov 2023 12:00:01 -0500 Subject: [PATCH 14/20] hide code cell --- docs/book/programs/gov/hmrc/income-tax.ipynb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index a6e90994b..bde4f6f28 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -83,7 +83,10 @@ "base_uri": "https://localhost:8080/" }, "id": "05DNxvPwgSRF", - "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b" + "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b", + "tags": [ + "hide-input" + ] }, "outputs": [ { @@ -255,7 +258,11 @@ { "cell_type": "code", "execution_count": 74, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { @@ -681,7 +688,11 @@ { "cell_type": "code", "execution_count": 67, - "metadata": {}, + "metadata": { + "tags": [ + "hide-input" + ] + }, "outputs": [ { "data": { From 2f56361d7e4cf4414170251ced73e8ad06fa2be8 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 16 Nov 2023 12:37:22 -0500 Subject: [PATCH 15/20] hide code cell --- docs/book/programs/gov/hmrc/income-tax.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb index bde4f6f28..7df27afcb 100644 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ b/docs/book/programs/gov/hmrc/income-tax.ipynb @@ -687,7 +687,7 @@ }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 1, "metadata": { "tags": [ "hide-input" From a7de65a0d898e72938c90b4f3c317242abe13ddd Mon Sep 17 00:00:00 2001 From: xiwang Date: Wed, 10 Jan 2024 23:20:18 -0500 Subject: [PATCH 16/20] add test cases for housing benefit --- changelog_entry.yaml | 3 +- docs/book/programs/gov/hmrc/income-tax.ipynb | 5693 ----------------- .../dwp/pension_credit/housing_benefit.yaml | 46 + 3 files changed, 47 insertions(+), 5695 deletions(-) delete mode 100644 docs/book/programs/gov/hmrc/income-tax.ipynb create mode 100644 policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml diff --git a/changelog_entry.yaml b/changelog_entry.yaml index d8a06ae4f..2c5468d4a 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,5 +1,4 @@ - bump: minor changes: added: - - Update National Insurance documentation - - Update Income Tax documentation + - Add test cases for housing benefit diff --git a/docs/book/programs/gov/hmrc/income-tax.ipynb b/docs/book/programs/gov/hmrc/income-tax.ipynb deleted file mode 100644 index 7df27afcb..000000000 --- a/docs/book/programs/gov/hmrc/income-tax.ipynb +++ /dev/null @@ -1,5693 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "SyCBxDvLJkZK" - }, - "source": [ - "# Income Tax" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "JODkfhOOLR45" - }, - "source": [ - "Income tax is a tax levied on the income earned by individuals and businesses. It is one of the primary sources of revenue for the UK government and is used to fund public services and government expenditures.\n", - "\n", - "- Tax Allowances:\n", - "These are specific amounts of income that individuals can earn before they are required to pay income tax. Various types of allowances exist, such as Personal Allowance, Marriage Allowance, Property Allowance, and Dividend Allowance, each offering different benefits and eligibility criteria.\n", - "\n", - "- Tax Charges:\n", - "Tax charges arise when an individual's income exceeds certain thresholds or when specific conditions are met. These charges fluctuate based on income levels and are influenced by additional factors, such as the High-Income Child Benefit Charge.\n", - "\n", - "- Tax Rates:\n", - "The government applies different percentages of tax rates based on the income bracket an individual falls into. There are Basic, Higher, and Additional rates, each applicable to respective income ranges. Moreover, specific types of income, like dividends, have their distinct tax rates.\n", - "\n", - "- Tax Reliefs:\n", - "To promote certain behaviors or lower the tax burden for specific groups, the government provides tax reliefs. These provisions reduce tax liability for eligible individuals, with examples including reliefs for Pension Contributions, Charitable Donations, and Work-Related Expenses.\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "ER87IhZtVPL6" - }, - "source": [ - "## Legislation" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "x9-zPzjkWT8k" - }, - "source": [ - "UK income tax legislation is grounded in primary legislation passed by the UK Parliament, supplemented by secondary legislation and administrative guidance issued by Her Majesty's Revenue and Customs (HMRC).\n", - "\n", - "- Income Tax Act 2007 (ITA 2007):\n", - "This is a central piece of legislation consolidating various statutes related to income tax in the UK. It comprehensively covers aspects such as the charge to tax, applicable rates, allowances, and reliefs, serving as a foundational reference for income tax matters.\n", - "\n", - "- Taxation of Chargeable Gains Act 1992 (TCGA 1992):\n", - "Though primarily focused on capital gains tax, this Act intersects significantly with income tax, particularly in the realm of taxation of gains. It provides detailed regulations on how gains should be taxed and calculated.\n", - "\n", - "- Income Tax (Earnings and Pensions) Act 2003 (ITEPA 2003):\n", - "ITEPA 2003 governs the rules related to the taxation of employment income, pension income, and social security income. It outlines the various categories and criteria for taxable earnings and pensions, ensuring a structured approach to taxation in these areas.\n", - "\n", - "- HMRC Manuals and Guidance:\n", - "Produced by HMRC, these comprehensive guides aim to help taxpayers in understanding and complying with the complex tax legislation. They provide practical insights and interpretations of the laws, offering clarity and assistance to both individuals and businesses in navigating the income tax landscape.\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "VaL6XOutgEU4" - }, - "source": [ - "## Methodology:\n", - "\n", - " Income tax logic can be found in policyengine-uk/policyengine_uk/variables/gov/hmrc/income_tax.\n", - "\n", - "The following table shows a series of income tax simulations using the PolicyEngine UK model." - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": { - "cellView": "form", - "colab": { - "base_uri": "https://localhost:8080/" - }, - "id": "05DNxvPwgSRF", - "outputId": "774742ee-057f-4c4e-edd9-816b3367cc9b", - "tags": [ - "hide-input" - ] - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
PersonEmployment Income (£)Dividend Income (£)Savings Interest Income (£)Income Tax (£)Dividend Income Tax (£)Savings Income Tax (£)
0Person15000010000500010068.52582.50.0
1Person260000150001000017457.04225.01800.0
2Person370000200001500026082.05850.03800.0
3Person480000250002000037707.07475.05800.0
4Person590000300002500045360.09100.07800.0
\n", - "
" - ], - "text/plain": [ - " Person Employment Income (£) Dividend Income (£) \\\n", - "0 Person1 50000 10000 \n", - "1 Person2 60000 15000 \n", - "2 Person3 70000 20000 \n", - "3 Person4 80000 25000 \n", - "4 Person5 90000 30000 \n", - "\n", - " Savings Interest Income (£) Income Tax (£) Dividend Income Tax (£) \\\n", - "0 5000 10068.5 2582.5 \n", - "1 10000 17457.0 4225.0 \n", - "2 15000 26082.0 5850.0 \n", - "3 20000 37707.0 7475.0 \n", - "4 25000 45360.0 9100.0 \n", - "\n", - " Savings Income Tax (£) \n", - "0 0.0 \n", - "1 1800.0 \n", - "2 3800.0 \n", - "3 5800.0 \n", - "4 7800.0 " - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import pandas as pd\n", - "from policyengine_uk import Simulation\n", - "\n", - "def calculate_taxes(employment_income, dividend_income, savings_interest_income):\n", - " simulation = Simulation(\n", - " situation={\n", - " \"people\": {\n", - " \"person\": {\n", - " \"employment_income\": employment_income,\n", - " \"dividend_income\": dividend_income,\n", - " \"savings_interest_income\": savings_interest_income\n", - " }\n", - " }\n", - " }\n", - " )\n", - " income_tax = simulation.calculate(\"income_tax\")[0]\n", - " dividend_income_tax = simulation.calculate(\"dividend_income_tax\")[0] # Added\n", - " savings_income_tax = simulation.calculate(\"savings_income_tax\")[0] # Added\n", - " \n", - " return income_tax, dividend_income_tax, savings_income_tax\n", - "\n", - "data = {\n", - " \"Person\": [\"Person1\", \"Person2\", \"Person3\", \"Person4\", \"Person5\"],\n", - " \"Employment Income (£)\": [50000, 60000, 70000, 80000, 90000],\n", - " \"Dividend Income (£)\": [10000, 15000, 20000, 25000, 30000],\n", - " \"Savings Interest Income (£)\": [5000, 10000, 15000, 20000, 25000],\n", - " \"Income Tax (£)\": [],\n", - " \"Dividend Income Tax (£)\": [],\n", - " \"Savings Income Tax (£)\": []\n", - "}\n", - "\n", - "for emp_income, div_income, sav_income in zip(data[\"Employment Income (£)\"], data[\"Dividend Income (£)\"], data[\"Savings Interest Income (£)\"]):\n", - " income_tax, div_tax, sav_tax = calculate_taxes(emp_income, div_income, sav_income)\n", - " data[\"Income Tax (£)\"].append(income_tax)\n", - " data[\"Dividend Income Tax (£)\"].append(div_tax)\n", - " data[\"Savings Income Tax (£)\"].append(sav_tax)\n", - "\n", - "df = pd.DataFrame(data)\n", - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "id": "DDa7lp9W3QVe" - }, - "source": [ - "## Appendix:\n", - "\n", - "The following tables display the parameter values for income tax allowance." - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "metadata": { - "tags": [ - "hide-input" - ] - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
AttributeTypeValueEffective DateUnit
0Annual AllowanceDefault40000.02015-06-01currency-GBP
1Annual AllowanceMinimum4000.02015-06-01currency-GBP
2Annual AllowanceReduction Rate0.52015-06-01marginal-rate
3Annual AllowanceTaper240000.02015-06-01currency-GBP
4Marriage AllowanceMax0.12016-04-01/1
5Marriage AllowanceRounding Increment10.02016-04-01currency-GBP
6Marriage AllowanceTakeup Rate1.02000-01-01/1
7Married Couples AllowanceDeduction Rate0.12010-01-01/1
8Personal AllowanceAmount12570.02025-04-06currency-GBP
9Personal AllowanceAmount12570.02021-04-06currency-GBP
10Personal AllowanceAmount12500.02019-04-06currency-GBP
11Personal AllowanceAmount11850.02018-04-06currency-GBP
12Personal AllowanceAmount11500.02017-04-06currency-GBP
13Personal AllowanceAmount10600.02015-04-06currency-GBP
14Personal Savings AllowanceAddtional Threshold0.02005-06-01currency-GBP
15Personal Savings AllowanceBasic Threshold1000.02005-06-01currency-GBP
16Personal Savings AllowanceHigher Threshold500.02005-06-01currency-GBP
17Dividend AllowanceDividend Allowance2000.02015-06-05currency-GBP
18Property AllowanceProperty Allowance1000.02005-06-01currency-GBP
19Trading AllowanceTrading Allowance1000.02005-06-01currency-GBP
\n", - "
" - ], - "text/plain": [ - " Attribute Type Value Effective Date \\\n", - "0 Annual Allowance Default 40000.0 2015-06-01 \n", - "1 Annual Allowance Minimum 4000.0 2015-06-01 \n", - "2 Annual Allowance Reduction Rate 0.5 2015-06-01 \n", - "3 Annual Allowance Taper 240000.0 2015-06-01 \n", - "4 Marriage Allowance Max 0.1 2016-04-01 \n", - "5 Marriage Allowance Rounding Increment 10.0 2016-04-01 \n", - "6 Marriage Allowance Takeup Rate 1.0 2000-01-01 \n", - "7 Married Couples Allowance Deduction Rate 0.1 2010-01-01 \n", - "8 Personal Allowance Amount 12570.0 2025-04-06 \n", - "9 Personal Allowance Amount 12570.0 2021-04-06 \n", - "10 Personal Allowance Amount 12500.0 2019-04-06 \n", - "11 Personal Allowance Amount 11850.0 2018-04-06 \n", - "12 Personal Allowance Amount 11500.0 2017-04-06 \n", - "13 Personal Allowance Amount 10600.0 2015-04-06 \n", - "14 Personal Savings Allowance Addtional Threshold 0.0 2005-06-01 \n", - "15 Personal Savings Allowance Basic Threshold 1000.0 2005-06-01 \n", - "16 Personal Savings Allowance Higher Threshold 500.0 2005-06-01 \n", - "17 Dividend Allowance Dividend Allowance 2000.0 2015-06-05 \n", - "18 Property Allowance Property Allowance 1000.0 2005-06-01 \n", - "19 Trading Allowance Trading Allowance 1000.0 2005-06-01 \n", - "\n", - " Unit \n", - "0 currency-GBP \n", - "1 currency-GBP \n", - "2 marginal-rate \n", - "3 currency-GBP \n", - "4 /1 \n", - "5 currency-GBP \n", - "6 /1 \n", - "7 /1 \n", - "8 currency-GBP \n", - "9 currency-GBP \n", - "10 currency-GBP \n", - "11 currency-GBP \n", - "12 currency-GBP \n", - "13 currency-GBP \n", - "14 currency-GBP \n", - "15 currency-GBP \n", - "16 currency-GBP \n", - "17 currency-GBP \n", - "18 currency-GBP \n", - "19 currency-GBP " - ] - }, - "execution_count": 74, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from policyengine_uk.system import system\n", - "import pandas as pd\n", - "\n", - "default = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.default\n", - "minimum = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.minimum\n", - "reduction_rate = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.reduction_rate\n", - "taper = system.parameters.gov.hmrc.income_tax.allowances.annual_allowance.taper\n", - "annual_allowance_data = {\n", - " \"Attribute\": [\"Annual Allowance\"] * 4,\n", - " \"Type\": [\"Default\", \"Minimum\", \"Reduction Rate\", \"Taper\"],\n", - " \"Value\": [\n", - " default.values_list[-1].value,\n", - " minimum.values_list[-1].value,\n", - " reduction_rate.values_list[-1].value,\n", - " taper.values_list[-1].value,\n", - " ],\n", - " \"Effective Date\": [\n", - " default.values_list[-1].instant_str,\n", - " minimum.values_list[-1].instant_str,\n", - " reduction_rate.values_list[-1].instant_str,\n", - " taper.values_list[-1].instant_str,\n", - " ],\n", - " \"Unit\": [default.metadata[\"unit\"], minimum.metadata[\"unit\"], reduction_rate.metadata[\"unit\"], taper.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "max = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.max\n", - "rounding_increment = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.rounding_increment\n", - "takeup_rate = system.parameters.gov.hmrc.income_tax.allowances.marriage_allowance.takeup_rate\n", - "marriage_allowance_data = {\n", - " \"Attribute\": [\"Marriage Allowance\"] * 3,\n", - " \"Type\": [\"Max\", \"Rounding Increment\", \"Takeup Rate\"],\n", - " \"Value\": [\n", - " max.values_list[-1].value,\n", - " rounding_increment.values_list[-1].value,\n", - " takeup_rate.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " max.values_list[-1].instant_str,\n", - " rounding_increment.values_list[-1].instant_str,\n", - " takeup_rate.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [max.metadata[\"unit\"], rounding_increment.metadata[\"unit\"], takeup_rate.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "deduction_rate = system.parameters.gov.hmrc.income_tax.allowances.married_couples_allowance.deduction_rate\n", - "married_couples_allowance_data = {\n", - " \"Attribute\": [\"Married Couples Allowance\"],\n", - " \"Type\": [\"Deduction Rate\"],\n", - " \"Value\": [\n", - " deduction_rate.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " deduction_rate.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [deduction_rate.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "amount = system.parameters.gov.hmrc.income_tax.allowances.personal_allowance.amount\n", - "values = [item.value for item in amount.values_list]\n", - "dates = [item.instant_str for item in amount.values_list]\n", - "personal_allowance_data = {\n", - " \"Attribute\": [\"Personal Allowance\"] * len(values),\n", - " \"Type\": [\"Amount\"] * len(values),\n", - " \"Value\": values,\n", - " \"Effective Date\": dates,\n", - " \"Unit\": [amount.metadata[\"unit\"]] * len(values)\n", - "}\n", - "\n", - "\n", - "addtional_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.additional\n", - "basic_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.basic\n", - "higher_threshold = system.parameters.gov.hmrc.income_tax.allowances.personal_savings_allowance.higher\n", - "personal_savings_allowance_data = {\n", - " \"Attribute\": [\"Personal Savings Allowance\"] * 3,\n", - " \"Type\": [\"Addtional Threshold\", \"Basic Threshold\", \"Higher Threshold\"],\n", - " \"Value\": [\n", - " addtional_threshold.values_list[-1].value,\n", - " basic_threshold.values_list[-1].value,\n", - " higher_threshold.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " addtional_threshold.values_list[-1].instant_str,\n", - " basic_threshold.values_list[-1].instant_str,\n", - " higher_threshold.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [addtional_threshold.metadata[\"unit\"], basic_threshold.metadata[\"unit\"], higher_threshold.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "dividend_allowance = system.parameters.gov.hmrc.income_tax.allowances.dividend_allowance\n", - "dividend_allowance_data = {\n", - " \"Attribute\": [\"Dividend Allowance\"],\n", - " \"Type\": [\"Dividend Allowance\"],\n", - " \"Value\": [\n", - " dividend_allowance.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " dividend_allowance.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [dividend_allowance.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "property_allowance = system.parameters.gov.hmrc.income_tax.allowances.property_allowance\n", - "property_allowance_data = {\n", - " \"Attribute\": [\"Property Allowance\"],\n", - " \"Type\": [\"Property Allowance\"],\n", - " \"Value\": [\n", - " property_allowance.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " property_allowance.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [property_allowance.metadata[\"unit\"]]\n", - "}\n", - "\n", - "\n", - "trading_allowance = system.parameters.gov.hmrc.income_tax.allowances.trading_allowance\n", - "trading_allowance_data = {\n", - " \"Attribute\": [\"Trading Allowance\"],\n", - " \"Type\": [\"Trading Allowance\"],\n", - " \"Value\": [\n", - " trading_allowance.values_list[-1].value\n", - " ],\n", - " \"Effective Date\": [\n", - " trading_allowance.values_list[-1].instant_str\n", - " ],\n", - " \"Unit\": [trading_allowance.metadata[\"unit\"]]\n", - "}\n", - "\n", - "annual_allowance_df = pd.DataFrame(annual_allowance_data)\n", - "marriage_allowance_df = pd.DataFrame(marriage_allowance_data)\n", - "married_couples_allowance_df = pd.DataFrame(married_couples_allowance_data)\n", - "personal_allowance_df = pd.DataFrame(personal_allowance_data)\n", - "personal_savings_allowance_df = pd.DataFrame(personal_savings_allowance_data)\n", - "dividend_allowance_df = pd.DataFrame(dividend_allowance_data)\n", - "property_allowance_df = pd.DataFrame(property_allowance_data)\n", - "trading_allowance_df = pd.DataFrame(trading_allowance_data)\n", - "\n", - "income_tax_allowance_df = pd.concat([\n", - " annual_allowance_df,\n", - " marriage_allowance_df,\n", - " married_couples_allowance_df,\n", - " personal_allowance_df,\n", - " personal_savings_allowance_df,\n", - " dividend_allowance_df,\n", - " property_allowance_df,\n", - " trading_allowance_df\n", - "], ignore_index=True)\n", - "income_tax_allowance_df" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Other income tax parameters can be found in policyengine-uk/policyengine_uk/parameters/gov/hmrc/income_tax." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Simulation" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "The figure illustrates the implementation of a simulation for computing income tax and dividend income tax using PolicyEngine UK model. The simulation is conducted for an individual aged 30 with a fixed dividend income of £10,000 while varying the employment income between £0 and £200,000." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "tags": [ - "hide-input" - ] - }, - "outputs": [ - { - "data": { - "application/vnd.plotly.v1+json": { - "config": { - "plotlyServerURL": "https://plot.ly" - }, - "data": [ - { - "hovertemplate": "Tax type=Income tax
Employment income=%{x}
Income tax (£)=%{y}", - "legendgroup": "Income tax", - "line": { - "color": "#636efa", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "Income tax", - "showlegend": true, - "type": "scattergl", - "x": [ - 0, - 200.2001953125, - 400.400390625, - 600.6005859375, - 800.80078125, - 1001.0009765625, - 1201.201171875, - 1401.4013671875, - 1601.6015625, - 1801.8017578125, - 2002.001953125, - 2202.2021484375, - 2402.40234375, - 2602.6025390625, - 2802.802734375, - 3003.0029296875, - 3203.203125, - 3403.4033203125, - 3603.603515625, - 3803.8037109375, - 4004.00390625, - 4204.2041015625, - 4404.404296875, - 4604.6044921875, - 4804.8046875, - 5005.0048828125, - 5205.205078125, - 5405.4052734375, - 5605.60546875, - 5805.8056640625, - 6006.005859375, - 6206.2060546875, - 6406.40625, - 6606.6064453125, - 6806.806640625, - 7007.0068359375, - 7207.20703125, - 7407.4072265625, - 7607.607421875, - 7807.8076171875, - 8008.0078125, - 8208.2080078125, - 8408.408203125, - 8608.6083984375, - 8808.80859375, - 9009.0087890625, - 9209.208984375, - 9409.4091796875, - 9609.609375, - 9809.8095703125, - 10010.009765625, - 10210.2099609375, - 10410.41015625, - 10610.6103515625, - 10810.810546875, - 11011.0107421875, - 11211.2109375, - 11411.4111328125, - 11611.611328125, - 11811.8115234375, - 12012.01171875, - 12212.2119140625, - 12412.412109375, - 12612.6123046875, - 12812.8125, - 13013.0126953125, - 13213.212890625, - 13413.4130859375, - 13613.61328125, - 13813.8134765625, - 14014.013671875, - 14214.2138671875, - 14414.4140625, - 14614.6142578125, - 14814.814453125, - 15015.0146484375, - 15215.21484375, - 15415.4150390625, - 15615.615234375, - 15815.8154296875, - 16016.015625, - 16216.2158203125, - 16416.416015625, - 16616.6171875, - 16816.81640625, - 17017.017578125, - 17217.216796875, - 17417.41796875, - 17617.6171875, - 17817.818359375, - 18018.017578125, - 18218.21875, - 18418.41796875, - 18618.619140625, - 18818.818359375, - 19019.01953125, - 19219.21875, - 19419.419921875, - 19619.619140625, - 19819.8203125, - 20020.01953125, - 20220.220703125, - 20420.419921875, - 20620.62109375, - 20820.8203125, - 21021.021484375, - 21221.220703125, - 21421.421875, - 21621.62109375, - 21821.822265625, - 22022.021484375, - 22222.22265625, - 22422.421875, - 22622.623046875, - 22822.822265625, - 23023.0234375, - 23223.22265625, - 23423.423828125, - 23623.623046875, - 23823.82421875, - 24024.0234375, - 24224.224609375, - 24424.423828125, - 24624.625, - 24824.82421875, - 25025.025390625, - 25225.224609375, - 25425.42578125, - 25625.625, - 25825.826171875, - 26026.025390625, - 26226.2265625, - 26426.42578125, - 26626.626953125, - 26826.826171875, - 27027.02734375, - 27227.2265625, - 27427.427734375, - 27627.626953125, - 27827.828125, - 28028.02734375, - 28228.228515625, - 28428.427734375, - 28628.62890625, - 28828.828125, - 29029.029296875, - 29229.228515625, - 29429.4296875, - 29629.62890625, - 29829.830078125, - 30030.029296875, - 30230.23046875, - 30430.4296875, - 30630.630859375, - 30830.830078125, - 31031.03125, - 31231.23046875, - 31431.431640625, - 31631.630859375, - 31831.83203125, - 32032.03125, - 32232.232421875, - 32432.431640625, - 32632.6328125, - 32832.83203125, - 33033.03125, - 33233.234375, - 33433.43359375, - 33633.6328125, - 33833.83203125, - 34034.03515625, - 34234.234375, - 34434.43359375, - 34634.6328125, - 34834.8359375, - 35035.03515625, - 35235.234375, - 35435.43359375, - 35635.63671875, - 35835.8359375, - 36036.03515625, - 36236.234375, - 36436.4375, - 36636.63671875, - 36836.8359375, - 37037.03515625, - 37237.23828125, - 37437.4375, - 37637.63671875, - 37837.8359375, - 38038.0390625, - 38238.23828125, - 38438.4375, - 38638.63671875, - 38838.83984375, - 39039.0390625, - 39239.23828125, - 39439.4375, - 39639.640625, - 39839.83984375, - 40040.0390625, - 40240.2421875, - 40440.44140625, - 40640.640625, - 40840.83984375, - 41041.04296875, - 41241.2421875, - 41441.44140625, - 41641.640625, - 41841.84375, - 42042.04296875, - 42242.2421875, - 42442.44140625, - 42642.64453125, - 42842.84375, - 43043.04296875, - 43243.2421875, - 43443.4453125, - 43643.64453125, - 43843.84375, - 44044.04296875, - 44244.24609375, - 44444.4453125, - 44644.64453125, - 44844.84375, - 45045.046875, - 45245.24609375, - 45445.4453125, - 45645.64453125, - 45845.84765625, - 46046.046875, - 46246.24609375, - 46446.4453125, - 46646.6484375, - 46846.84765625, - 47047.046875, - 47247.24609375, - 47447.44921875, - 47647.6484375, - 47847.84765625, - 48048.046875, - 48248.25, - 48448.44921875, - 48648.6484375, - 48848.84765625, - 49049.05078125, - 49249.25, - 49449.44921875, - 49649.6484375, - 49849.8515625, - 50050.05078125, - 50250.25, - 50450.44921875, - 50650.65234375, - 50850.8515625, - 51051.05078125, - 51251.25, - 51451.453125, - 51651.65234375, - 51851.8515625, - 52052.05078125, - 52252.25390625, - 52452.453125, - 52652.65234375, - 52852.8515625, - 53053.0546875, - 53253.25390625, - 53453.453125, - 53653.65234375, - 53853.85546875, - 54054.0546875, - 54254.25390625, - 54454.453125, - 54654.65625, - 54854.85546875, - 55055.0546875, - 55255.25390625, - 55455.45703125, - 55655.65625, - 55855.85546875, - 56056.0546875, - 56256.2578125, - 56456.45703125, - 56656.65625, - 56856.85546875, - 57057.05859375, - 57257.2578125, - 57457.45703125, - 57657.65625, - 57857.859375, - 58058.05859375, - 58258.2578125, - 58458.45703125, - 58658.66015625, - 58858.859375, - 59059.05859375, - 59259.2578125, - 59459.4609375, - 59659.66015625, - 59859.859375, - 60060.05859375, - 60260.26171875, - 60460.4609375, - 60660.66015625, - 60860.859375, - 61061.0625, - 61261.26171875, - 61461.4609375, - 61661.66015625, - 61861.86328125, - 62062.0625, - 62262.26171875, - 62462.4609375, - 62662.6640625, - 62862.86328125, - 63063.0625, - 63263.26171875, - 63463.46484375, - 63663.6640625, - 63863.86328125, - 64064.0625, - 64264.265625, - 64464.46484375, - 64664.6640625, - 64864.86328125, - 65065.06640625, - 65265.265625, - 65465.46484375, - 65665.6640625, - 65865.8671875, - 66066.0625, - 66266.265625, - 66466.46875, - 66666.6640625, - 66866.8671875, - 67067.0703125, - 67267.265625, - 67467.46875, - 67667.6640625, - 67867.8671875, - 68068.0703125, - 68268.265625, - 68468.46875, - 68668.671875, - 68868.8671875, - 69069.0703125, - 69269.265625, - 69469.46875, - 69669.671875, - 69869.8671875, - 70070.0703125, - 70270.2734375, - 70470.46875, - 70670.671875, - 70870.8671875, - 71071.0703125, - 71271.2734375, - 71471.46875, - 71671.671875, - 71871.875, - 72072.0703125, - 72272.2734375, - 72472.46875, - 72672.671875, - 72872.875, - 73073.0703125, - 73273.2734375, - 73473.4765625, - 73673.671875, - 73873.875, - 74074.0703125, - 74274.2734375, - 74474.4765625, - 74674.671875, - 74874.875, - 75075.078125, - 75275.2734375, - 75475.4765625, - 75675.671875, - 75875.875, - 76076.078125, - 76276.2734375, - 76476.4765625, - 76676.6796875, - 76876.875, - 77077.078125, - 77277.2734375, - 77477.4765625, - 77677.6796875, - 77877.875, - 78078.078125, - 78278.28125, - 78478.4765625, - 78678.6796875, - 78878.875, - 79079.078125, - 79279.28125, - 79479.4765625, - 79679.6796875, - 79879.8828125, - 80080.078125, - 80280.28125, - 80480.484375, - 80680.6796875, - 80880.8828125, - 81081.078125, - 81281.28125, - 81481.484375, - 81681.6796875, - 81881.8828125, - 82082.0859375, - 82282.28125, - 82482.484375, - 82682.6796875, - 82882.8828125, - 83083.0859375, - 83283.28125, - 83483.484375, - 83683.6875, - 83883.8828125, - 84084.0859375, - 84284.28125, - 84484.484375, - 84684.6875, - 84884.8828125, - 85085.0859375, - 85285.2890625, - 85485.484375, - 85685.6875, - 85885.8828125, - 86086.0859375, - 86286.2890625, - 86486.484375, - 86686.6875, - 86886.890625, - 87087.0859375, - 87287.2890625, - 87487.484375, - 87687.6875, - 87887.890625, - 88088.0859375, - 88288.2890625, - 88488.4921875, - 88688.6875, - 88888.890625, - 89089.0859375, - 89289.2890625, - 89489.4921875, - 89689.6875, - 89889.890625, - 90090.09375, - 90290.2890625, - 90490.4921875, - 90690.6875, - 90890.890625, - 91091.09375, - 91291.2890625, - 91491.4921875, - 91691.6953125, - 91891.890625, - 92092.09375, - 92292.2890625, - 92492.4921875, - 92692.6953125, - 92892.890625, - 93093.09375, - 93293.296875, - 93493.4921875, - 93693.6953125, - 93893.890625, - 94094.09375, - 94294.296875, - 94494.4921875, - 94694.6953125, - 94894.8984375, - 95095.09375, - 95295.296875, - 95495.4921875, - 95695.6953125, - 95895.8984375, - 96096.09375, - 96296.296875, - 96496.5, - 96696.6953125, - 96896.8984375, - 97097.09375, - 97297.296875, - 97497.5, - 97697.6953125, - 97897.8984375, - 98098.1015625, - 98298.296875, - 98498.5, - 98698.6953125, - 98898.8984375, - 99099.1015625, - 99299.296875, - 99499.5, - 99699.703125, - 99899.8984375, - 100100.1015625, - 100300.296875, - 100500.5, - 100700.703125, - 100900.8984375, - 101101.1015625, - 101301.3046875, - 101501.5, - 101701.703125, - 101901.8984375, - 102102.1015625, - 102302.3046875, - 102502.5, - 102702.703125, - 102902.90625, - 103103.1015625, - 103303.3046875, - 103503.5, - 103703.703125, - 103903.90625, - 104104.1015625, - 104304.3046875, - 104504.5078125, - 104704.703125, - 104904.90625, - 105105.1015625, - 105305.3046875, - 105505.5078125, - 105705.703125, - 105905.90625, - 106106.109375, - 106306.3046875, - 106506.5078125, - 106706.703125, - 106906.90625, - 107107.109375, - 107307.3046875, - 107507.5078125, - 107707.7109375, - 107907.90625, - 108108.109375, - 108308.3046875, - 108508.5078125, - 108708.7109375, - 108908.90625, - 109109.109375, - 109309.3125, - 109509.5078125, - 109709.7109375, - 109909.90625, - 110110.109375, - 110310.3125, - 110510.5078125, - 110710.7109375, - 110910.9140625, - 111111.109375, - 111311.3125, - 111511.5078125, - 111711.7109375, - 111911.9140625, - 112112.109375, - 112312.3125, - 112512.515625, - 112712.7109375, - 112912.9140625, - 113113.109375, - 113313.3125, - 113513.515625, - 113713.7109375, - 113913.9140625, - 114114.1171875, - 114314.3125, - 114514.515625, - 114714.7109375, - 114914.9140625, - 115115.1171875, - 115315.3125, - 115515.515625, - 115715.71875, - 115915.9140625, - 116116.1171875, - 116316.3125, - 116516.515625, - 116716.71875, - 116916.9140625, - 117117.1171875, - 117317.3203125, - 117517.515625, - 117717.71875, - 117917.9140625, - 118118.1171875, - 118318.3203125, - 118518.515625, - 118718.71875, - 118918.921875, - 119119.1171875, - 119319.3203125, - 119519.515625, - 119719.71875, - 119919.921875, - 120120.1171875, - 120320.3203125, - 120520.5234375, - 120720.71875, - 120920.921875, - 121121.125, - 121321.3203125, - 121521.5234375, - 121721.71875, - 121921.921875, - 122122.125, - 122322.3203125, - 122522.5234375, - 122722.7265625, - 122922.921875, - 123123.125, - 123323.3203125, - 123523.5234375, - 123723.7265625, - 123923.921875, - 124124.125, - 124324.328125, - 124524.5234375, - 124724.7265625, - 124924.921875, - 125125.125, - 125325.328125, - 125525.5234375, - 125725.7265625, - 125925.9296875, - 126126.125, - 126326.328125, - 126526.5234375, - 126726.7265625, - 126926.9296875, - 127127.125, - 127327.328125, - 127527.53125, - 127727.7265625, - 127927.9296875, - 128128.125, - 128328.328125, - 128528.53125, - 128728.7265625, - 128928.9296875, - 129129.1328125, - 129329.328125, - 129529.53125, - 129729.7265625, - 129929.9296875, - 130130.1328125, - 130330.328125, - 130530.53125, - 130730.734375, - 130930.9296875, - 131131.125, - 131331.328125, - 131531.53125, - 131731.734375, - 131931.9375, - 132132.125, - 132332.328125, - 132532.53125, - 132732.734375, - 132932.9375, - 133133.140625, - 133333.328125, - 133533.53125, - 133733.734375, - 133933.9375, - 134134.140625, - 134334.328125, - 134534.53125, - 134734.734375, - 134934.9375, - 135135.140625, - 135335.328125, - 135535.53125, - 135735.734375, - 135935.9375, - 136136.140625, - 136336.34375, - 136536.53125, - 136736.734375, - 136936.9375, - 137137.140625, - 137337.34375, - 137537.53125, - 137737.734375, - 137937.9375, - 138138.140625, - 138338.34375, - 138538.53125, - 138738.734375, - 138938.9375, - 139139.140625, - 139339.34375, - 139539.546875, - 139739.734375, - 139939.9375, - 140140.140625, - 140340.34375, - 140540.546875, - 140740.734375, - 140940.9375, - 141141.140625, - 141341.34375, - 141541.546875, - 141741.734375, - 141941.9375, - 142142.140625, - 142342.34375, - 142542.546875, - 142742.75, - 142942.9375, - 143143.140625, - 143343.34375, - 143543.546875, - 143743.75, - 143943.9375, - 144144.140625, - 144344.34375, - 144544.546875, - 144744.75, - 144944.9375, - 145145.140625, - 145345.34375, - 145545.546875, - 145745.75, - 145945.953125, - 146146.140625, - 146346.34375, - 146546.546875, - 146746.75, - 146946.953125, - 147147.140625, - 147347.34375, - 147547.546875, - 147747.75, - 147947.953125, - 148148.140625, - 148348.34375, - 148548.546875, - 148748.75, - 148948.953125, - 149149.15625, - 149349.34375, - 149549.546875, - 149749.75, - 149949.953125, - 150150.15625, - 150350.34375, - 150550.546875, - 150750.75, - 150950.953125, - 151151.15625, - 151351.34375, - 151551.546875, - 151751.75, - 151951.953125, - 152152.15625, - 152352.359375, - 152552.546875, - 152752.75, - 152952.953125, - 153153.15625, - 153353.359375, - 153553.546875, - 153753.75, - 153953.953125, - 154154.15625, - 154354.359375, - 154554.546875, - 154754.75, - 154954.953125, - 155155.15625, - 155355.359375, - 155555.5625, - 155755.75, - 155955.953125, - 156156.15625, - 156356.359375, - 156556.5625, - 156756.75, - 156956.953125, - 157157.15625, - 157357.359375, - 157557.5625, - 157757.75, - 157957.953125, - 158158.15625, - 158358.359375, - 158558.5625, - 158758.765625, - 158958.953125, - 159159.15625, - 159359.359375, - 159559.5625, - 159759.765625, - 159959.953125, - 160160.15625, - 160360.359375, - 160560.5625, - 160760.765625, - 160960.96875, - 161161.15625, - 161361.359375, - 161561.5625, - 161761.765625, - 161961.96875, - 162162.15625, - 162362.359375, - 162562.5625, - 162762.765625, - 162962.96875, - 163163.15625, - 163363.359375, - 163563.5625, - 163763.765625, - 163963.96875, - 164164.171875, - 164364.359375, - 164564.5625, - 164764.765625, - 164964.96875, - 165165.171875, - 165365.359375, - 165565.5625, - 165765.765625, - 165965.96875, - 166166.171875, - 166366.359375, - 166566.5625, - 166766.765625, - 166966.96875, - 167167.171875, - 167367.375, - 167567.5625, - 167767.765625, - 167967.96875, - 168168.171875, - 168368.375, - 168568.5625, - 168768.765625, - 168968.96875, - 169169.171875, - 169369.375, - 169569.5625, - 169769.765625, - 169969.96875, - 170170.171875, - 170370.375, - 170570.578125, - 170770.765625, - 170970.96875, - 171171.171875, - 171371.375, - 171571.578125, - 171771.765625, - 171971.96875, - 172172.171875, - 172372.375, - 172572.578125, - 172772.765625, - 172972.96875, - 173173.171875, - 173373.375, - 173573.578125, - 173773.78125, - 173973.96875, - 174174.171875, - 174374.375, - 174574.578125, - 174774.78125, - 174974.96875, - 175175.171875, - 175375.375, - 175575.578125, - 175775.78125, - 175975.96875, - 176176.171875, - 176376.375, - 176576.578125, - 176776.78125, - 176976.984375, - 177177.171875, - 177377.375, - 177577.578125, - 177777.78125, - 177977.984375, - 178178.171875, - 178378.375, - 178578.578125, - 178778.78125, - 178978.984375, - 179179.171875, - 179379.375, - 179579.578125, - 179779.78125, - 179979.984375, - 180180.1875, - 180380.375, - 180580.578125, - 180780.78125, - 180980.984375, - 181181.1875, - 181381.375, - 181581.578125, - 181781.78125, - 181981.984375, - 182182.1875, - 182382.375, - 182582.578125, - 182782.78125, - 182982.984375, - 183183.1875, - 183383.390625, - 183583.578125, - 183783.78125, - 183983.984375, - 184184.1875, - 184384.390625, - 184584.578125, - 184784.78125, - 184984.984375, - 185185.1875, - 185385.390625, - 185585.578125, - 185785.78125, - 185985.984375, - 186186.1875, - 186386.390625, - 186586.59375, - 186786.78125, - 186986.984375, - 187187.1875, - 187387.390625, - 187587.59375, - 187787.78125, - 187987.984375, - 188188.1875, - 188388.390625, - 188588.59375, - 188788.78125, - 188988.984375, - 189189.1875, - 189389.390625, - 189589.59375, - 189789.796875, - 189989.984375, - 190190.1875, - 190390.390625, - 190590.59375, - 190790.796875, - 190990.984375, - 191191.1875, - 191391.390625, - 191591.59375, - 191791.796875, - 191991.984375, - 192192.1875, - 192392.390625, - 192592.59375, - 192792.796875, - 192993, - 193193.1875, - 193393.390625, - 193593.59375, - 193793.796875, - 193994, - 194194.1875, - 194394.390625, - 194594.59375, - 194794.796875, - 194995, - 195195.1875, - 195395.390625, - 195595.59375, - 195795.796875, - 195996, - 196196.203125, - 196396.390625, - 196596.59375, - 196796.796875, - 196997, - 197197.203125, - 197397.390625, - 197597.59375, - 197797.796875, - 197998, - 198198.203125, - 198398.390625, - 198598.59375, - 198798.796875, - 198999, - 199199.203125, - 199399.40625, - 199599.59375, - 199799.796875, - 200000 - ], - "xaxis": "x", - "y": [ - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 608.5226440429688, - 648.5625, - 688.6023559570312, - 728.642578125, - 768.6828002929688, - 808.72265625, - 848.7625122070312, - 888.802734375, - 928.8429565429688, - 968.8828125, - 1008.9226684570312, - 1048.962890625, - 1089.003173828125, - 1129.04296875, - 1169.082763671875, - 1209.123046875, - 1249.163330078125, - 1289.203125, - 1329.242919921875, - 1369.283203125, - 1409.323486328125, - 1449.36328125, - 1489.403564453125, - 1529.443359375, - 1569.483642578125, - 1609.5234375, - 1649.563720703125, - 1689.603515625, - 1729.643798828125, - 1769.68359375, - 1809.723876953125, - 1849.763671875, - 1889.803955078125, - 1929.84375, - 1969.884033203125, - 2009.923828125, - 2049.964111328125, - 2090.00390625, - 2130.044189453125, - 2170.083984375, - 2210.124267578125, - 2250.1640625, - 2290.204345703125, - 2330.244140625, - 2370.284423828125, - 2410.32421875, - 2450.364501953125, - 2490.404296875, - 2530.444580078125, - 2570.484375, - 2610.524658203125, - 2650.56396484375, - 2690.604736328125, - 2730.64453125, - 2770.684326171875, - 2810.72509765625, - 2850.764892578125, - 2890.8046875, - 2930.84521484375, - 2970.88427734375, - 3010.925048828125, - 3050.96484375, - 3091.004638671875, - 3131.04541015625, - 3171.085205078125, - 3211.125, - 3251.16552734375, - 3291.20458984375, - 3331.245361328125, - 3371.28515625, - 3411.324951171875, - 3451.36572265625, - 3491.405517578125, - 3531.4453125, - 3571.48583984375, - 3611.52490234375, - 3651.565673828125, - 3691.60546875, - 3731.645263671875, - 3771.68603515625, - 3811.725830078125, - 3851.765625, - 3891.80615234375, - 3931.84521484375, - 3971.885986328125, - 4011.92578125, - 4051.965576171875, - 4092.00634765625, - 4132.0458984375, - 4172.0859375, - 4212.12646484375, - 4252.16552734375, - 4292.2060546875, - 4332.24609375, - 4372.2861328125, - 4412.32666015625, - 4452.3662109375, - 4492.40625, - 4532.44677734375, - 4572.48583984375, - 4612.5263671875, - 4652.56640625, - 4692.6064453125, - 4732.64697265625, - 4772.6865234375, - 4812.7265625, - 4852.7666015625, - 4892.80712890625, - 4932.8466796875, - 4972.88671875, - 5012.9267578125, - 5052.96728515625, - 5093.0068359375, - 5133.046875, - 5173.0869140625, - 5213.12744140625, - 5253.1669921875, - 5293.20703125, - 5333.2470703125, - 5373.28759765625, - 5413.3271484375, - 5453.3671875, - 5493.4072265625, - 5533.44775390625, - 5573.4873046875, - 5613.52734375, - 5653.5673828125, - 5693.60791015625, - 5733.6474609375, - 5773.6875, - 5813.7275390625, - 5853.76806640625, - 5893.8076171875, - 5933.84765625, - 5973.8876953125, - 6013.92822265625, - 6053.9677734375, - 6094.0078125, - 6134.04833984375, - 6174.08837890625, - 6214.1279296875, - 6254.16796875, - 6294.20849609375, - 6334.24853515625, - 6374.2880859375, - 6414.328125, - 6454.36865234375, - 6494.40869140625, - 6577.5087890625, - 6667.5986328125, - 6757.68994140625, - 6847.77978515625, - 6937.869140625, - 7027.958984375, - 7118.05029296875, - 7208.14013671875, - 7298.2294921875, - 7388.3193359375, - 7478.41064453125, - 7568.50048828125, - 7658.58984375, - 7748.6796875, - 7838.77099609375, - 7928.86083984375, - 8018.9501953125, - 8109.0400390625, - 8199.130859375, - 8289.220703125, - 8379.310546875, - 8469.400390625, - 8559.4921875, - 8649.58203125, - 8739.6708984375, - 8829.7607421875, - 8919.8515625, - 9009.94140625, - 9100.03125, - 9190.12109375, - 9280.212890625, - 9370.302734375, - 9460.3916015625, - 9550.4814453125, - 9640.572265625, - 9730.662109375, - 9820.751953125, - 9910.841796875, - 10000.93359375, - 10091.0234375, - 10136.0498046875, - 10212.1796875, - 10292.2607421875, - 10372.3408203125, - 10452.419921875, - 10532.5, - 10612.5810546875, - 10692.6611328125, - 10772.740234375, - 10852.8203125, - 10932.9013671875, - 11012.9814453125, - 11093.060546875, - 11173.140625, - 11253.2216796875, - 11333.3017578125, - 11413.380859375, - 11493.4609375, - 11573.5419921875, - 11653.6220703125, - 11733.701171875, - 11813.78125, - 11893.8623046875, - 11973.9423828125, - 12054.021484375, - 12134.1015625, - 12214.1826171875, - 12294.2626953125, - 12374.34375, - 12454.421875, - 12534.5029296875, - 12614.5810546875, - 12694.662109375, - 12774.744140625, - 12854.8251953125, - 12934.9033203125, - 13014.9814453125, - 13095.0625, - 13175.1435546875, - 13255.224609375, - 13335.302734375, - 13415.380859375, - 13495.462890625, - 13575.5439453125, - 13655.625, - 13735.703125, - 13815.7841796875, - 13895.8623046875, - 13975.943359375, - 14056.025390625, - 14136.1064453125, - 14216.1845703125, - 14296.2626953125, - 14376.34375, - 14456.4248046875, - 14536.505859375, - 14616.583984375, - 14696.662109375, - 14776.744140625, - 14856.8251953125, - 14936.90625, - 15016.984375, - 15097.0654296875, - 15177.1435546875, - 15257.224609375, - 15337.306640625, - 15417.3876953125, - 15497.4658203125, - 15577.5439453125, - 15657.625, - 15737.7060546875, - 15817.787109375, - 15897.865234375, - 15977.943359375, - 16058.025390625, - 16138.1064453125, - 16218.1875, - 16298.265625, - 16378.3466796875, - 16458.42578125, - 16538.505859375, - 16618.587890625, - 16698.666015625, - 16778.74609375, - 16858.828125, - 16938.90625, - 17018.98828125, - 17099.06640625, - 17179.146484375, - 17259.228515625, - 17339.306640625, - 17419.38671875, - 17499.46875, - 17579.546875, - 17659.62890625, - 17739.70703125, - 17819.787109375, - 17899.869140625, - 17979.947265625, - 18060.02734375, - 18140.109375, - 18220.1875, - 18300.26953125, - 18380.34765625, - 18460.427734375, - 18540.509765625, - 18620.587890625, - 18700.66796875, - 18780.75, - 18860.828125, - 18940.91015625, - 19020.98828125, - 19101.068359375, - 19181.150390625, - 19261.228515625, - 19341.30859375, - 19421.390625, - 19501.46875, - 19581.55078125, - 19661.62890625, - 19741.708984375, - 19821.791015625, - 19901.869140625, - 19981.94921875, - 20062.03125, - 20142.109375, - 20222.19140625, - 20302.26953125, - 20382.349609375, - 20462.431640625, - 20542.509765625, - 20622.58984375, - 20702.671875, - 20782.75, - 20862.83203125, - 20942.91015625, - 21022.990234375, - 21103.072265625, - 21183.150390625, - 21263.23046875, - 21343.3125, - 21423.390625, - 21503.47265625, - 21583.55078125, - 21663.630859375, - 21743.712890625, - 21823.791015625, - 21903.87109375, - 21983.953125, - 22064.03125, - 22144.11328125, - 22224.193359375, - 22304.271484375, - 22384.353515625, - 22464.431640625, - 22544.51171875, - 22624.59375, - 22704.671875, - 22784.75390625, - 22864.833984375, - 22944.912109375, - 23024.994140625, - 23105.072265625, - 23185.15234375, - 23265.234375, - 23345.3125, - 23425.39453125, - 23505.474609375, - 23585.552734375, - 23665.634765625, - 23745.712890625, - 23825.79296875, - 23905.875, - 23985.953125, - 24066.03515625, - 24146.115234375, - 24226.193359375, - 24306.275390625, - 24386.353515625, - 24466.43359375, - 24546.515625, - 24626.59375, - 24706.67578125, - 24786.755859375, - 24866.833984375, - 24946.916015625, - 25026.994140625, - 25107.07421875, - 25187.15625, - 25267.234375, - 25347.31640625, - 25427.396484375, - 25507.474609375, - 25587.556640625, - 25667.634765625, - 25747.71484375, - 25827.796875, - 25907.875, - 25987.95703125, - 26086.056640625, - 26206.17578125, - 26326.29296875, - 26446.412109375, - 26566.53515625, - 26686.65625, - 26806.775390625, - 26926.89453125, - 27047.01953125, - 27167.134765625, - 27287.255859375, - 27407.375, - 27527.494140625, - 27647.619140625, - 27767.734375, - 27887.85546875, - 28007.978515625, - 28128.09375, - 28248.21875, - 28368.333984375, - 28488.45703125, - 28608.578125, - 28728.693359375, - 28848.818359375, - 28968.9375, - 29089.056640625, - 29209.177734375, - 29329.29296875, - 29449.41796875, - 29569.537109375, - 29689.65625, - 29809.77734375, - 29929.900390625, - 30050.01953125, - 30170.13671875, - 30290.255859375, - 30410.37890625, - 30530.5, - 30650.619140625, - 30770.73828125, - 30890.86328125, - 31010.978515625, - 31131.099609375, - 31251.21875, - 31371.337890625, - 31491.462890625, - 31611.578125, - 31731.69921875, - 31851.822265625, - 31971.9375, - 32092.0625, - 32212.177734375, - 32332.30078125, - 32452.421875, - 32572.537109375, - 32692.662109375, - 32812.78125, - 32932.8984375, - 33053.0234375, - 33173.13671875, - 33293.26171875, - 33413.3828125, - 33533.5, - 33653.62109375, - 33773.7421875, - 33893.86328125, - 34013.98046875, - 34134.1015625, - 34254.22265625, - 34374.34375, - 34494.4609375, - 34614.58203125, - 34734.70703125, - 34854.8203125, - 34974.9453125, - 35095.0625, - 35215.1796875, - 35335.3046875, - 35455.421875, - 35575.54296875, - 35695.6640625, - 35815.78125, - 35935.90625, - 36056.0234375, - 36176.14453125, - 36296.265625, - 36416.3828125, - 36536.5078125, - 36656.625, - 36776.7421875, - 36896.8671875, - 37016.98046875, - 37137.10546875, - 37257.2265625, - 37377.34375, - 37497.46484375, - 37617.5859375, - 37737.70703125, - 37857.82421875, - 37977.9453125, - 38098.06640625, - 38218.1875, - 38338.3046875, - 38458.42578125, - 38578.55078125, - 38698.6640625, - 38818.7890625, - 38938.90625, - 39059.0234375, - 39179.1484375, - 39299.265625, - 39419.38671875, - 39539.5078125, - 39659.625, - 39779.75, - 39899.8671875, - 40019.98828125, - 40140.109375, - 40260.2265625, - 40380.3515625, - 40500.46875, - 40620.5859375, - 40740.7109375, - 40860.82421875, - 40980.94921875, - 41101.0703125, - 41186.125, - 41266.20703125, - 41346.2890625, - 41426.3671875, - 41506.4453125, - 41586.5234375, - 41666.60546875, - 41746.6875, - 41826.765625, - 41906.84765625, - 41986.9296875, - 42067.0078125, - 42147.0859375, - 42227.1640625, - 42307.24609375, - 42387.328125, - 42467.40625, - 42547.48828125, - 42627.5703125, - 42707.6484375, - 42787.7265625, - 42867.8046875, - 42947.88671875, - 43027.96875, - 43108.046875, - 43188.12890625, - 43268.2109375, - 43348.2890625, - 43428.3671875, - 43508.44921875, - 43588.5234375, - 43668.61328125, - 43748.6875, - 43828.76953125, - 43908.8515625, - 43988.92578125, - 44069.01171875, - 44149.0859375, - 44229.16796875, - 44309.25, - 44389.32421875, - 44469.4140625, - 44549.48828125, - 44629.5703125, - 44709.6484375, - 44789.73046875, - 44869.8125, - 44949.88671875, - 45029.96875, - 45110.05078125, - 45190.1328125, - 45270.2109375, - 45350.2890625, - 45430.375, - 45510.44921875, - 45590.53125, - 45670.61328125, - 45750.6875, - 45830.7734375, - 45910.8515625, - 45990.9296875, - 46071.01171875, - 46151.0859375, - 46231.17578125, - 46311.25, - 46391.33203125, - 46471.4140625, - 46551.48828125, - 46631.57421875, - 46711.6484375, - 46791.73046875, - 46871.8125, - 46951.88671875, - 47031.9765625, - 47112.05078125, - 47192.1328125, - 47272.2109375, - 47352.29296875, - 47432.375, - 47512.44921875, - 47592.53125, - 47672.61328125, - 47752.6953125, - 47832.7734375, - 47912.8515625, - 47992.9296875, - 48073.01171875, - 48153.09375, - 48233.17578125, - 48313.2578125, - 48393.33203125, - 48473.4140625, - 48553.4921875, - 48633.57421875, - 48713.65625, - 48793.73046875, - 48873.8125, - 48953.89453125, - 49033.9765625, - 49114.0546875, - 49194.1328125, - 49274.2109375, - 49354.29296875, - 49434.375, - 49514.45703125, - 49594.5390625, - 49674.61328125, - 49754.6953125, - 49834.7734375, - 49914.85546875, - 49994.9375, - 50075.01171875, - 50155.09375, - 50235.17578125, - 50315.2578125, - 50395.3359375, - 50475.4140625, - 50555.4921875, - 50635.57421875, - 50715.65625, - 50795.73828125, - 50875.8203125, - 50955.89453125, - 51035.9765625, - 51116.0546875, - 51196.13671875, - 51276.21875, - 51356.29296875, - 51436.375, - 51516.45703125, - 51596.5390625, - 51676.6171875, - 51756.6953125, - 51836.7734375, - 51924.81640625, - 52016.109375, - 52107.40234375, - 52198.6953125, - 52289.98046875, - 52381.2734375, - 52472.5625, - 52563.85546875, - 52655.1484375, - 52746.43359375, - 52837.7265625, - 52929.0234375, - 53020.31640625, - 53111.60546875, - 53202.89453125, - 53294.18359375, - 53385.4765625, - 53476.76953125, - 53568.0625, - 53659.35546875, - 53750.640625, - 53841.93359375, - 53933.22265625, - 54024.515625, - 54115.8125, - 54207.09375, - 54298.390625, - 54389.68359375, - 54480.9765625, - 54572.265625, - 54663.5546875, - 54754.84375, - 54846.13671875, - 54937.4296875, - 55028.72265625, - 55120.015625, - 55211.30078125, - 55302.59375, - 55393.8828125, - 55485.1796875, - 55575.5703125, - 55665.65625, - 55755.74609375, - 55845.8359375, - 55935.9296875, - 56026.01953125, - 56116.10546875, - 56206.1953125, - 56296.2890625, - 56386.37890625, - 56476.46875, - 56566.5625, - 56656.64453125, - 56746.73828125, - 56836.828125, - 56926.921875, - 57017.01171875, - 57107.09765625, - 57197.1875, - 57287.27734375, - 57377.37109375, - 57467.4609375, - 57557.546875, - 57647.63671875, - 57737.73046875, - 57827.8203125, - 57917.91015625, - 58008.00390625, - 58098.0859375, - 58188.1796875, - 58278.26953125, - 58368.36328125, - 58458.453125, - 58548.5390625, - 58638.62890625, - 58728.71875, - 58818.8125, - 58908.90234375, - 58998.98828125, - 59089.078125, - 59179.171875, - 59269.26171875, - 59359.3515625, - 59449.4453125, - 59539.52734375, - 59629.62109375, - 59719.7109375, - 59809.8046875, - 59899.89453125, - 59989.98046875, - 60080.0703125, - 60170.16015625, - 60260.25390625, - 60350.34375, - 60440.4375, - 60530.51953125, - 60620.61328125, - 60710.703125, - 60800.79296875, - 60890.88671875, - 60980.96875, - 61071.0625, - 61161.15234375, - 61251.24609375, - 61341.3359375, - 61431.421875, - 61521.51171875, - 61611.6015625, - 61701.6953125, - 61791.78515625, - 61881.87890625, - 61971.9609375, - 62062.0546875, - 62152.14453125, - 62242.234375, - 62332.328125, - 62422.41015625, - 62512.50390625, - 62602.59375, - 62692.6875, - 62782.77734375, - 62872.86328125, - 62962.953125, - 63053.04296875, - 63143.13671875, - 63233.2265625, - 63323.3203125, - 63413.40234375, - 63503.49609375, - 63593.5859375, - 63683.67578125, - 63773.76953125, - 63863.8515625, - 63953.9453125, - 64044.03515625, - 64134.12890625, - 64224.21875, - 64314.3046875, - 64404.39453125, - 64494.484375, - 64584.578125, - 64674.66796875, - 64764.76171875, - 64854.84375, - 64944.9375, - 65035.02734375, - 65125.1171875, - 65215.2109375, - 65305.29296875, - 65395.38671875, - 65485.4765625, - 65575.5703125, - 65665.65625, - 65755.75, - 65845.8359375, - 65935.921875, - 66026.015625, - 66116.109375, - 66206.203125, - 66296.28125, - 66386.375, - 66476.46875, - 66566.5625, - 66656.65625, - 66746.734375, - 66836.828125, - 66926.921875, - 67017.015625, - 67107.1015625, - 67197.1875, - 67287.28125, - 67377.3671875, - 67467.4609375, - 67557.546875, - 67647.640625, - 67737.7265625, - 67827.8203125, - 67917.90625, - 68008, - 68098.09375, - 68188.171875, - 68278.265625, - 68368.359375, - 68458.453125, - 68548.546875, - 68638.625, - 68728.71875, - 68818.8125, - 68908.8984375, - 68998.9921875, - 69089.0859375, - 69179.171875, - 69269.2578125, - 69359.3515625, - 69449.4453125, - 69539.53125, - 69629.6171875, - 69719.7109375, - 69809.8046875, - 69899.890625, - 69989.984375, - 70080.0703125, - 70170.15625, - 70260.25, - 70350.34375, - 70440.4375, - 70530.5234375, - 70620.609375, - 70710.703125, - 70800.796875, - 70890.8828125, - 70980.9765625, - 71071.0625, - 71161.1484375, - 71251.2421875, - 71341.3359375, - 71431.421875, - 71521.5078125, - 71611.6015625, - 71701.6953125, - 71791.78125, - 71881.875, - 71971.96875, - 72062.0546875, - 72152.140625, - 72242.234375, - 72332.328125, - 72422.4140625, - 72512.5, - 72602.59375, - 72692.6875, - 72782.7734375, - 72872.8671875, - 72962.953125, - 73053.046875, - 73143.1328125, - 73233.2265625, - 73323.3203125, - 73413.40625, - 73503.4921875, - 73593.5859375, - 73683.671875, - 73773.765625, - 73863.859375, - 73953.9453125, - 74044.03125, - 74134.125, - 74224.21875, - 74314.3125, - 74404.390625, - 74494.484375, - 74584.578125, - 74674.6640625, - 74764.7578125, - 74854.8515625, - 74944.9375, - 75035.0234375, - 75125.1171875, - 75215.2109375, - 75305.296875, - 75395.3828125, - 75485.4765625, - 75575.5703125, - 75665.65625, - 75755.75, - 75845.8359375, - 75935.921875, - 76026.015625, - 76116.109375, - 76206.203125, - 76296.2890625, - 76386.375, - 76476.46875, - 76566.5625, - 76656.6484375, - 76746.7421875, - 76836.828125, - 76926.9140625, - 77017.0078125, - 77107.1015625, - 77197.1875, - 77287.2734375, - 77377.3671875, - 77467.4609375, - 77557.546875, - 77647.640625, - 77737.734375, - 77827.8203125, - 77917.90625, - 78008 - ], - "yaxis": "y" - }, - { - "hovertemplate": "Tax type=Dividend income tax
Employment income=%{x}
Income tax (£)=%{y}", - "legendgroup": "Dividend income tax", - "line": { - "color": "#EF553B", - "dash": "solid" - }, - "marker": { - "symbol": "circle" - }, - "mode": "lines", - "name": "Dividend income tax", - "showlegend": true, - "type": "scattergl", - "x": [ - 0, - 200.2001953125, - 400.400390625, - 600.6005859375, - 800.80078125, - 1001.0009765625, - 1201.201171875, - 1401.4013671875, - 1601.6015625, - 1801.8017578125, - 2002.001953125, - 2202.2021484375, - 2402.40234375, - 2602.6025390625, - 2802.802734375, - 3003.0029296875, - 3203.203125, - 3403.4033203125, - 3603.603515625, - 3803.8037109375, - 4004.00390625, - 4204.2041015625, - 4404.404296875, - 4604.6044921875, - 4804.8046875, - 5005.0048828125, - 5205.205078125, - 5405.4052734375, - 5605.60546875, - 5805.8056640625, - 6006.005859375, - 6206.2060546875, - 6406.40625, - 6606.6064453125, - 6806.806640625, - 7007.0068359375, - 7207.20703125, - 7407.4072265625, - 7607.607421875, - 7807.8076171875, - 8008.0078125, - 8208.2080078125, - 8408.408203125, - 8608.6083984375, - 8808.80859375, - 9009.0087890625, - 9209.208984375, - 9409.4091796875, - 9609.609375, - 9809.8095703125, - 10010.009765625, - 10210.2099609375, - 10410.41015625, - 10610.6103515625, - 10810.810546875, - 11011.0107421875, - 11211.2109375, - 11411.4111328125, - 11611.611328125, - 11811.8115234375, - 12012.01171875, - 12212.2119140625, - 12412.412109375, - 12612.6123046875, - 12812.8125, - 13013.0126953125, - 13213.212890625, - 13413.4130859375, - 13613.61328125, - 13813.8134765625, - 14014.013671875, - 14214.2138671875, - 14414.4140625, - 14614.6142578125, - 14814.814453125, - 15015.0146484375, - 15215.21484375, - 15415.4150390625, - 15615.615234375, - 15815.8154296875, - 16016.015625, - 16216.2158203125, - 16416.416015625, - 16616.6171875, - 16816.81640625, - 17017.017578125, - 17217.216796875, - 17417.41796875, - 17617.6171875, - 17817.818359375, - 18018.017578125, - 18218.21875, - 18418.41796875, - 18618.619140625, - 18818.818359375, - 19019.01953125, - 19219.21875, - 19419.419921875, - 19619.619140625, - 19819.8203125, - 20020.01953125, - 20220.220703125, - 20420.419921875, - 20620.62109375, - 20820.8203125, - 21021.021484375, - 21221.220703125, - 21421.421875, - 21621.62109375, - 21821.822265625, - 22022.021484375, - 22222.22265625, - 22422.421875, - 22622.623046875, - 22822.822265625, - 23023.0234375, - 23223.22265625, - 23423.423828125, - 23623.623046875, - 23823.82421875, - 24024.0234375, - 24224.224609375, - 24424.423828125, - 24624.625, - 24824.82421875, - 25025.025390625, - 25225.224609375, - 25425.42578125, - 25625.625, - 25825.826171875, - 26026.025390625, - 26226.2265625, - 26426.42578125, - 26626.626953125, - 26826.826171875, - 27027.02734375, - 27227.2265625, - 27427.427734375, - 27627.626953125, - 27827.828125, - 28028.02734375, - 28228.228515625, - 28428.427734375, - 28628.62890625, - 28828.828125, - 29029.029296875, - 29229.228515625, - 29429.4296875, - 29629.62890625, - 29829.830078125, - 30030.029296875, - 30230.23046875, - 30430.4296875, - 30630.630859375, - 30830.830078125, - 31031.03125, - 31231.23046875, - 31431.431640625, - 31631.630859375, - 31831.83203125, - 32032.03125, - 32232.232421875, - 32432.431640625, - 32632.6328125, - 32832.83203125, - 33033.03125, - 33233.234375, - 33433.43359375, - 33633.6328125, - 33833.83203125, - 34034.03515625, - 34234.234375, - 34434.43359375, - 34634.6328125, - 34834.8359375, - 35035.03515625, - 35235.234375, - 35435.43359375, - 35635.63671875, - 35835.8359375, - 36036.03515625, - 36236.234375, - 36436.4375, - 36636.63671875, - 36836.8359375, - 37037.03515625, - 37237.23828125, - 37437.4375, - 37637.63671875, - 37837.8359375, - 38038.0390625, - 38238.23828125, - 38438.4375, - 38638.63671875, - 38838.83984375, - 39039.0390625, - 39239.23828125, - 39439.4375, - 39639.640625, - 39839.83984375, - 40040.0390625, - 40240.2421875, - 40440.44140625, - 40640.640625, - 40840.83984375, - 41041.04296875, - 41241.2421875, - 41441.44140625, - 41641.640625, - 41841.84375, - 42042.04296875, - 42242.2421875, - 42442.44140625, - 42642.64453125, - 42842.84375, - 43043.04296875, - 43243.2421875, - 43443.4453125, - 43643.64453125, - 43843.84375, - 44044.04296875, - 44244.24609375, - 44444.4453125, - 44644.64453125, - 44844.84375, - 45045.046875, - 45245.24609375, - 45445.4453125, - 45645.64453125, - 45845.84765625, - 46046.046875, - 46246.24609375, - 46446.4453125, - 46646.6484375, - 46846.84765625, - 47047.046875, - 47247.24609375, - 47447.44921875, - 47647.6484375, - 47847.84765625, - 48048.046875, - 48248.25, - 48448.44921875, - 48648.6484375, - 48848.84765625, - 49049.05078125, - 49249.25, - 49449.44921875, - 49649.6484375, - 49849.8515625, - 50050.05078125, - 50250.25, - 50450.44921875, - 50650.65234375, - 50850.8515625, - 51051.05078125, - 51251.25, - 51451.453125, - 51651.65234375, - 51851.8515625, - 52052.05078125, - 52252.25390625, - 52452.453125, - 52652.65234375, - 52852.8515625, - 53053.0546875, - 53253.25390625, - 53453.453125, - 53653.65234375, - 53853.85546875, - 54054.0546875, - 54254.25390625, - 54454.453125, - 54654.65625, - 54854.85546875, - 55055.0546875, - 55255.25390625, - 55455.45703125, - 55655.65625, - 55855.85546875, - 56056.0546875, - 56256.2578125, - 56456.45703125, - 56656.65625, - 56856.85546875, - 57057.05859375, - 57257.2578125, - 57457.45703125, - 57657.65625, - 57857.859375, - 58058.05859375, - 58258.2578125, - 58458.45703125, - 58658.66015625, - 58858.859375, - 59059.05859375, - 59259.2578125, - 59459.4609375, - 59659.66015625, - 59859.859375, - 60060.05859375, - 60260.26171875, - 60460.4609375, - 60660.66015625, - 60860.859375, - 61061.0625, - 61261.26171875, - 61461.4609375, - 61661.66015625, - 61861.86328125, - 62062.0625, - 62262.26171875, - 62462.4609375, - 62662.6640625, - 62862.86328125, - 63063.0625, - 63263.26171875, - 63463.46484375, - 63663.6640625, - 63863.86328125, - 64064.0625, - 64264.265625, - 64464.46484375, - 64664.6640625, - 64864.86328125, - 65065.06640625, - 65265.265625, - 65465.46484375, - 65665.6640625, - 65865.8671875, - 66066.0625, - 66266.265625, - 66466.46875, - 66666.6640625, - 66866.8671875, - 67067.0703125, - 67267.265625, - 67467.46875, - 67667.6640625, - 67867.8671875, - 68068.0703125, - 68268.265625, - 68468.46875, - 68668.671875, - 68868.8671875, - 69069.0703125, - 69269.265625, - 69469.46875, - 69669.671875, - 69869.8671875, - 70070.0703125, - 70270.2734375, - 70470.46875, - 70670.671875, - 70870.8671875, - 71071.0703125, - 71271.2734375, - 71471.46875, - 71671.671875, - 71871.875, - 72072.0703125, - 72272.2734375, - 72472.46875, - 72672.671875, - 72872.875, - 73073.0703125, - 73273.2734375, - 73473.4765625, - 73673.671875, - 73873.875, - 74074.0703125, - 74274.2734375, - 74474.4765625, - 74674.671875, - 74874.875, - 75075.078125, - 75275.2734375, - 75475.4765625, - 75675.671875, - 75875.875, - 76076.078125, - 76276.2734375, - 76476.4765625, - 76676.6796875, - 76876.875, - 77077.078125, - 77277.2734375, - 77477.4765625, - 77677.6796875, - 77877.875, - 78078.078125, - 78278.28125, - 78478.4765625, - 78678.6796875, - 78878.875, - 79079.078125, - 79279.28125, - 79479.4765625, - 79679.6796875, - 79879.8828125, - 80080.078125, - 80280.28125, - 80480.484375, - 80680.6796875, - 80880.8828125, - 81081.078125, - 81281.28125, - 81481.484375, - 81681.6796875, - 81881.8828125, - 82082.0859375, - 82282.28125, - 82482.484375, - 82682.6796875, - 82882.8828125, - 83083.0859375, - 83283.28125, - 83483.484375, - 83683.6875, - 83883.8828125, - 84084.0859375, - 84284.28125, - 84484.484375, - 84684.6875, - 84884.8828125, - 85085.0859375, - 85285.2890625, - 85485.484375, - 85685.6875, - 85885.8828125, - 86086.0859375, - 86286.2890625, - 86486.484375, - 86686.6875, - 86886.890625, - 87087.0859375, - 87287.2890625, - 87487.484375, - 87687.6875, - 87887.890625, - 88088.0859375, - 88288.2890625, - 88488.4921875, - 88688.6875, - 88888.890625, - 89089.0859375, - 89289.2890625, - 89489.4921875, - 89689.6875, - 89889.890625, - 90090.09375, - 90290.2890625, - 90490.4921875, - 90690.6875, - 90890.890625, - 91091.09375, - 91291.2890625, - 91491.4921875, - 91691.6953125, - 91891.890625, - 92092.09375, - 92292.2890625, - 92492.4921875, - 92692.6953125, - 92892.890625, - 93093.09375, - 93293.296875, - 93493.4921875, - 93693.6953125, - 93893.890625, - 94094.09375, - 94294.296875, - 94494.4921875, - 94694.6953125, - 94894.8984375, - 95095.09375, - 95295.296875, - 95495.4921875, - 95695.6953125, - 95895.8984375, - 96096.09375, - 96296.296875, - 96496.5, - 96696.6953125, - 96896.8984375, - 97097.09375, - 97297.296875, - 97497.5, - 97697.6953125, - 97897.8984375, - 98098.1015625, - 98298.296875, - 98498.5, - 98698.6953125, - 98898.8984375, - 99099.1015625, - 99299.296875, - 99499.5, - 99699.703125, - 99899.8984375, - 100100.1015625, - 100300.296875, - 100500.5, - 100700.703125, - 100900.8984375, - 101101.1015625, - 101301.3046875, - 101501.5, - 101701.703125, - 101901.8984375, - 102102.1015625, - 102302.3046875, - 102502.5, - 102702.703125, - 102902.90625, - 103103.1015625, - 103303.3046875, - 103503.5, - 103703.703125, - 103903.90625, - 104104.1015625, - 104304.3046875, - 104504.5078125, - 104704.703125, - 104904.90625, - 105105.1015625, - 105305.3046875, - 105505.5078125, - 105705.703125, - 105905.90625, - 106106.109375, - 106306.3046875, - 106506.5078125, - 106706.703125, - 106906.90625, - 107107.109375, - 107307.3046875, - 107507.5078125, - 107707.7109375, - 107907.90625, - 108108.109375, - 108308.3046875, - 108508.5078125, - 108708.7109375, - 108908.90625, - 109109.109375, - 109309.3125, - 109509.5078125, - 109709.7109375, - 109909.90625, - 110110.109375, - 110310.3125, - 110510.5078125, - 110710.7109375, - 110910.9140625, - 111111.109375, - 111311.3125, - 111511.5078125, - 111711.7109375, - 111911.9140625, - 112112.109375, - 112312.3125, - 112512.515625, - 112712.7109375, - 112912.9140625, - 113113.109375, - 113313.3125, - 113513.515625, - 113713.7109375, - 113913.9140625, - 114114.1171875, - 114314.3125, - 114514.515625, - 114714.7109375, - 114914.9140625, - 115115.1171875, - 115315.3125, - 115515.515625, - 115715.71875, - 115915.9140625, - 116116.1171875, - 116316.3125, - 116516.515625, - 116716.71875, - 116916.9140625, - 117117.1171875, - 117317.3203125, - 117517.515625, - 117717.71875, - 117917.9140625, - 118118.1171875, - 118318.3203125, - 118518.515625, - 118718.71875, - 118918.921875, - 119119.1171875, - 119319.3203125, - 119519.515625, - 119719.71875, - 119919.921875, - 120120.1171875, - 120320.3203125, - 120520.5234375, - 120720.71875, - 120920.921875, - 121121.125, - 121321.3203125, - 121521.5234375, - 121721.71875, - 121921.921875, - 122122.125, - 122322.3203125, - 122522.5234375, - 122722.7265625, - 122922.921875, - 123123.125, - 123323.3203125, - 123523.5234375, - 123723.7265625, - 123923.921875, - 124124.125, - 124324.328125, - 124524.5234375, - 124724.7265625, - 124924.921875, - 125125.125, - 125325.328125, - 125525.5234375, - 125725.7265625, - 125925.9296875, - 126126.125, - 126326.328125, - 126526.5234375, - 126726.7265625, - 126926.9296875, - 127127.125, - 127327.328125, - 127527.53125, - 127727.7265625, - 127927.9296875, - 128128.125, - 128328.328125, - 128528.53125, - 128728.7265625, - 128928.9296875, - 129129.1328125, - 129329.328125, - 129529.53125, - 129729.7265625, - 129929.9296875, - 130130.1328125, - 130330.328125, - 130530.53125, - 130730.734375, - 130930.9296875, - 131131.125, - 131331.328125, - 131531.53125, - 131731.734375, - 131931.9375, - 132132.125, - 132332.328125, - 132532.53125, - 132732.734375, - 132932.9375, - 133133.140625, - 133333.328125, - 133533.53125, - 133733.734375, - 133933.9375, - 134134.140625, - 134334.328125, - 134534.53125, - 134734.734375, - 134934.9375, - 135135.140625, - 135335.328125, - 135535.53125, - 135735.734375, - 135935.9375, - 136136.140625, - 136336.34375, - 136536.53125, - 136736.734375, - 136936.9375, - 137137.140625, - 137337.34375, - 137537.53125, - 137737.734375, - 137937.9375, - 138138.140625, - 138338.34375, - 138538.53125, - 138738.734375, - 138938.9375, - 139139.140625, - 139339.34375, - 139539.546875, - 139739.734375, - 139939.9375, - 140140.140625, - 140340.34375, - 140540.546875, - 140740.734375, - 140940.9375, - 141141.140625, - 141341.34375, - 141541.546875, - 141741.734375, - 141941.9375, - 142142.140625, - 142342.34375, - 142542.546875, - 142742.75, - 142942.9375, - 143143.140625, - 143343.34375, - 143543.546875, - 143743.75, - 143943.9375, - 144144.140625, - 144344.34375, - 144544.546875, - 144744.75, - 144944.9375, - 145145.140625, - 145345.34375, - 145545.546875, - 145745.75, - 145945.953125, - 146146.140625, - 146346.34375, - 146546.546875, - 146746.75, - 146946.953125, - 147147.140625, - 147347.34375, - 147547.546875, - 147747.75, - 147947.953125, - 148148.140625, - 148348.34375, - 148548.546875, - 148748.75, - 148948.953125, - 149149.15625, - 149349.34375, - 149549.546875, - 149749.75, - 149949.953125, - 150150.15625, - 150350.34375, - 150550.546875, - 150750.75, - 150950.953125, - 151151.15625, - 151351.34375, - 151551.546875, - 151751.75, - 151951.953125, - 152152.15625, - 152352.359375, - 152552.546875, - 152752.75, - 152952.953125, - 153153.15625, - 153353.359375, - 153553.546875, - 153753.75, - 153953.953125, - 154154.15625, - 154354.359375, - 154554.546875, - 154754.75, - 154954.953125, - 155155.15625, - 155355.359375, - 155555.5625, - 155755.75, - 155955.953125, - 156156.15625, - 156356.359375, - 156556.5625, - 156756.75, - 156956.953125, - 157157.15625, - 157357.359375, - 157557.5625, - 157757.75, - 157957.953125, - 158158.15625, - 158358.359375, - 158558.5625, - 158758.765625, - 158958.953125, - 159159.15625, - 159359.359375, - 159559.5625, - 159759.765625, - 159959.953125, - 160160.15625, - 160360.359375, - 160560.5625, - 160760.765625, - 160960.96875, - 161161.15625, - 161361.359375, - 161561.5625, - 161761.765625, - 161961.96875, - 162162.15625, - 162362.359375, - 162562.5625, - 162762.765625, - 162962.96875, - 163163.15625, - 163363.359375, - 163563.5625, - 163763.765625, - 163963.96875, - 164164.171875, - 164364.359375, - 164564.5625, - 164764.765625, - 164964.96875, - 165165.171875, - 165365.359375, - 165565.5625, - 165765.765625, - 165965.96875, - 166166.171875, - 166366.359375, - 166566.5625, - 166766.765625, - 166966.96875, - 167167.171875, - 167367.375, - 167567.5625, - 167767.765625, - 167967.96875, - 168168.171875, - 168368.375, - 168568.5625, - 168768.765625, - 168968.96875, - 169169.171875, - 169369.375, - 169569.5625, - 169769.765625, - 169969.96875, - 170170.171875, - 170370.375, - 170570.578125, - 170770.765625, - 170970.96875, - 171171.171875, - 171371.375, - 171571.578125, - 171771.765625, - 171971.96875, - 172172.171875, - 172372.375, - 172572.578125, - 172772.765625, - 172972.96875, - 173173.171875, - 173373.375, - 173573.578125, - 173773.78125, - 173973.96875, - 174174.171875, - 174374.375, - 174574.578125, - 174774.78125, - 174974.96875, - 175175.171875, - 175375.375, - 175575.578125, - 175775.78125, - 175975.96875, - 176176.171875, - 176376.375, - 176576.578125, - 176776.78125, - 176976.984375, - 177177.171875, - 177377.375, - 177577.578125, - 177777.78125, - 177977.984375, - 178178.171875, - 178378.375, - 178578.578125, - 178778.78125, - 178978.984375, - 179179.171875, - 179379.375, - 179579.578125, - 179779.78125, - 179979.984375, - 180180.1875, - 180380.375, - 180580.578125, - 180780.78125, - 180980.984375, - 181181.1875, - 181381.375, - 181581.578125, - 181781.78125, - 181981.984375, - 182182.1875, - 182382.375, - 182582.578125, - 182782.78125, - 182982.984375, - 183183.1875, - 183383.390625, - 183583.578125, - 183783.78125, - 183983.984375, - 184184.1875, - 184384.390625, - 184584.578125, - 184784.78125, - 184984.984375, - 185185.1875, - 185385.390625, - 185585.578125, - 185785.78125, - 185985.984375, - 186186.1875, - 186386.390625, - 186586.59375, - 186786.78125, - 186986.984375, - 187187.1875, - 187387.390625, - 187587.59375, - 187787.78125, - 187987.984375, - 188188.1875, - 188388.390625, - 188588.59375, - 188788.78125, - 188988.984375, - 189189.1875, - 189389.390625, - 189589.59375, - 189789.796875, - 189989.984375, - 190190.1875, - 190390.390625, - 190590.59375, - 190790.796875, - 190990.984375, - 191191.1875, - 191391.390625, - 191591.59375, - 191791.796875, - 191991.984375, - 192192.1875, - 192392.390625, - 192592.59375, - 192792.796875, - 192993, - 193193.1875, - 193393.390625, - 193593.59375, - 193793.796875, - 193994, - 194194.1875, - 194394.390625, - 194594.59375, - 194794.796875, - 194995, - 195195.1875, - 195395.390625, - 195595.59375, - 195795.796875, - 195996, - 196196.203125, - 196396.390625, - 196596.59375, - 196796.796875, - 196997, - 197197.203125, - 197397.390625, - 197597.59375, - 197797.796875, - 197998, - 198198.203125, - 198398.390625, - 198598.59375, - 198798.796875, - 198999, - 199199.203125, - 199399.40625, - 199599.59375, - 199799.796875, - 200000 - ], - "xaxis": "x", - "y": [ - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 600, - 643.060546875, - 693.1103515625, - 743.1611328125, - 793.2109375, - 843.2607421875, - 893.310546875, - 943.361328125, - 993.4111328125, - 1043.4609375, - 1093.5107421875, - 1143.5615234375, - 1193.611328125, - 1243.6611328125, - 1293.7109375, - 1343.76171875, - 1393.8115234375, - 1443.861328125, - 1493.9111328125, - 1543.9619140625, - 1594.01171875, - 1644.0615234375, - 1694.111328125, - 1744.162109375, - 1794.2119140625, - 1844.26171875, - 1894.3115234375, - 1944.3623046875, - 1994.412109375, - 2044.4619140625, - 2094.51171875, - 2144.5625, - 2194.6123046875, - 2244.662109375, - 2294.7119140625, - 2344.7626953125, - 2394.8125, - 2444.8623046875, - 2494.912109375, - 2544.962890625, - 2595.0126953125, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2600, - 2607.9599609375, - 2619.171142578125, - 2630.382568359375, - 2641.593994140625, - 2652.804443359375, - 2664.015869140625, - 2675.227294921875, - 2686.438720703125, - 2697.64990234375, - 2708.860595703125, - 2720.07177734375, - 2731.283203125, - 2742.49462890625, - 2753.7060546875, - 2764.91650390625, - 2776.1279296875, - 2787.33935546875, - 2798.550537109375, - 2809.761962890625, - 2820.973388671875, - 2832.183837890625, - 2843.395263671875, - 2854.606689453125, - 2865.818115234375, - 2877.029296875, - 2888.239990234375, - 2899.451171875, - 2910.66259765625, - 2921.8740234375, - 2933.08544921875, - 2944.2958984375, - 2955.50732421875, - 2966.718505859375, - 2977.929931640625, - 2989.141357421875, - 3000.352783203125, - 3011.563232421875, - 3022.774658203125, - 3033.986083984375, - 3045.197265625, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048, - 3048 - ], - "yaxis": "y" - } - ], - "layout": { - "font": { - "color": "black", - "family": "Roboto Serif" - }, - "height": 600, - "images": [ - { - "sizex": 0.2, - "sizey": 0.2, - "source": "https://raw.githubusercontent.com/PolicyEngine/policyengine-app/master/src/images/logos/policyengine/blue.png", - "x": 1, - "xanchor": "right", - "xref": "paper", - "y": -0.15, - "yanchor": "bottom", - "yref": "paper" - } - ], - "legend": { - "title": { - "text": "Tax type" - }, - "tracegroupgap": 0 - }, - "modebar": { - "bgcolor": "rgba(0,0,0,0)", - "color": "rgba(0,0,0,0)" - }, - "template": { - "data": { - "bar": [ - { - "error_x": { - "color": "#2a3f5f" - }, - "error_y": { - "color": "#2a3f5f" - }, - "marker": { - "line": { - "color": "white", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "bar" - } - ], - "barpolar": [ - { - "marker": { - "line": { - "color": "white", - "width": 0.5 - }, - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "barpolar" - } - ], - "carpet": [ - { - "aaxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "#C8D4E3", - "linecolor": "#C8D4E3", - "minorgridcolor": "#C8D4E3", - "startlinecolor": "#2a3f5f" - }, - "baxis": { - "endlinecolor": "#2a3f5f", - "gridcolor": "#C8D4E3", - "linecolor": "#C8D4E3", - "minorgridcolor": "#C8D4E3", - "startlinecolor": "#2a3f5f" - }, - "type": "carpet" - } - ], - "choropleth": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "choropleth" - } - ], - "contour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "contour" - } - ], - "contourcarpet": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "contourcarpet" - } - ], - "heatmap": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmap" - } - ], - "heatmapgl": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "heatmapgl" - } - ], - "histogram": [ - { - "marker": { - "pattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - } - }, - "type": "histogram" - } - ], - "histogram2d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2d" - } - ], - "histogram2dcontour": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "histogram2dcontour" - } - ], - "mesh3d": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "type": "mesh3d" - } - ], - "parcoords": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "parcoords" - } - ], - "pie": [ - { - "automargin": true, - "type": "pie" - } - ], - "scatter": [ - { - "fillpattern": { - "fillmode": "overlay", - "size": 10, - "solidity": 0.2 - }, - "type": "scatter" - } - ], - "scatter3d": [ - { - "line": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatter3d" - } - ], - "scattercarpet": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattercarpet" - } - ], - "scattergeo": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergeo" - } - ], - "scattergl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattergl" - } - ], - "scattermapbox": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scattermapbox" - } - ], - "scatterpolar": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolar" - } - ], - "scatterpolargl": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterpolargl" - } - ], - "scatterternary": [ - { - "marker": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "type": "scatterternary" - } - ], - "surface": [ - { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - }, - "colorscale": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "type": "surface" - } - ], - "table": [ - { - "cells": { - "fill": { - "color": "#EBF0F8" - }, - "line": { - "color": "white" - } - }, - "header": { - "fill": { - "color": "#C8D4E3" - }, - "line": { - "color": "white" - } - }, - "type": "table" - } - ] - }, - "layout": { - "annotationdefaults": { - "arrowcolor": "#2a3f5f", - "arrowhead": 0, - "arrowwidth": 1 - }, - "autotypenumbers": "strict", - "coloraxis": { - "colorbar": { - "outlinewidth": 0, - "ticks": "" - } - }, - "colorscale": { - "diverging": [ - [ - 0, - "#8e0152" - ], - [ - 0.1, - "#c51b7d" - ], - [ - 0.2, - "#de77ae" - ], - [ - 0.3, - "#f1b6da" - ], - [ - 0.4, - "#fde0ef" - ], - [ - 0.5, - "#f7f7f7" - ], - [ - 0.6, - "#e6f5d0" - ], - [ - 0.7, - "#b8e186" - ], - [ - 0.8, - "#7fbc41" - ], - [ - 0.9, - "#4d9221" - ], - [ - 1, - "#276419" - ] - ], - "sequential": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ], - "sequentialminus": [ - [ - 0, - "#0d0887" - ], - [ - 0.1111111111111111, - "#46039f" - ], - [ - 0.2222222222222222, - "#7201a8" - ], - [ - 0.3333333333333333, - "#9c179e" - ], - [ - 0.4444444444444444, - "#bd3786" - ], - [ - 0.5555555555555556, - "#d8576b" - ], - [ - 0.6666666666666666, - "#ed7953" - ], - [ - 0.7777777777777778, - "#fb9f3a" - ], - [ - 0.8888888888888888, - "#fdca26" - ], - [ - 1, - "#f0f921" - ] - ] - }, - "colorway": [ - "#636efa", - "#EF553B", - "#00cc96", - "#ab63fa", - "#FFA15A", - "#19d3f3", - "#FF6692", - "#B6E880", - "#FF97FF", - "#FECB52" - ], - "font": { - "color": "#2a3f5f" - }, - "geo": { - "bgcolor": "white", - "lakecolor": "white", - "landcolor": "white", - "showlakes": true, - "showland": true, - "subunitcolor": "#C8D4E3" - }, - "hoverlabel": { - "align": "left" - }, - "hovermode": "closest", - "mapbox": { - "style": "light" - }, - "paper_bgcolor": "white", - "plot_bgcolor": "white", - "polar": { - "angularaxis": { - "gridcolor": "#EBF0F8", - "linecolor": "#EBF0F8", - "ticks": "" - }, - "bgcolor": "white", - "radialaxis": { - "gridcolor": "#EBF0F8", - "linecolor": "#EBF0F8", - "ticks": "" - } - }, - "scene": { - "xaxis": { - "backgroundcolor": "white", - "gridcolor": "#DFE8F3", - "gridwidth": 2, - "linecolor": "#EBF0F8", - "showbackground": true, - "ticks": "", - "zerolinecolor": "#EBF0F8" - }, - "yaxis": { - "backgroundcolor": "white", - "gridcolor": "#DFE8F3", - "gridwidth": 2, - "linecolor": "#EBF0F8", - "showbackground": true, - "ticks": "", - "zerolinecolor": "#EBF0F8" - }, - "zaxis": { - "backgroundcolor": "white", - "gridcolor": "#DFE8F3", - "gridwidth": 2, - "linecolor": "#EBF0F8", - "showbackground": true, - "ticks": "", - "zerolinecolor": "#EBF0F8" - } - }, - "shapedefaults": { - "line": { - "color": "#2a3f5f" - } - }, - "ternary": { - "aaxis": { - "gridcolor": "#DFE8F3", - "linecolor": "#A2B1C6", - "ticks": "" - }, - "baxis": { - "gridcolor": "#DFE8F3", - "linecolor": "#A2B1C6", - "ticks": "" - }, - "bgcolor": "white", - "caxis": { - "gridcolor": "#DFE8F3", - "linecolor": "#A2B1C6", - "ticks": "" - } - }, - "title": { - "x": 0.05 - }, - "xaxis": { - "automargin": true, - "gridcolor": "#EBF0F8", - "linecolor": "#EBF0F8", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "#EBF0F8", - "zerolinewidth": 2 - }, - "yaxis": { - "automargin": true, - "gridcolor": "#EBF0F8", - "linecolor": "#EBF0F8", - "ticks": "", - "title": { - "standoff": 15 - }, - "zerolinecolor": "#EBF0F8", - "zerolinewidth": 2 - } - } - }, - "title": { - "text": "Income tax vs employment income" - }, - "width": 800, - "xaxis": { - "anchor": "y", - "domain": [ - 0, - 1 - ], - "title": { - "text": "Employment income" - } - }, - "yaxis": { - "anchor": "x", - "domain": [ - 0, - 1 - ], - "title": { - "text": "Income tax (£)" - } - } - } - } - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "from policyengine_uk import Simulation\n", - "\n", - "simulation = Simulation(\n", - " situation=dict(\n", - " people=dict(\n", - " person=dict(\n", - " age=30,\n", - " dividend_income=10_000,\n", - " )\n", - " ),\n", - " axes=[[\n", - " dict(\n", - " name=\"employment_income\",\n", - " min=0,\n", - " max=200_000,\n", - " count=1_000,\n", - " )\n", - " ]]\n", - " ),\n", - ")\n", - "\n", - "import plotly.express as px\n", - "import pandas as pd\n", - "from policyengine_core.charts import format_fig\n", - "\n", - "df = pd.DataFrame({\n", - " \"Employment income\": simulation.calculate(\"employment_income\"),\n", - " \"Income tax\": simulation.calculate(\"income_tax\"),\n", - " \"Dividend income tax\": simulation.calculate(\"dividend_income_tax\"),\n", - "})\n", - "\n", - "fig = px.line(\n", - " df,\n", - " x=\"Employment income\",\n", - " y=[\"Income tax\", \"Dividend income tax\"],\n", - " title=\"Income tax vs employment income\",\n", - " labels={\n", - " \"value\": \"Income tax (£)\",\n", - " \"variable\": \"Tax type\",\n", - " },\n", - ")\n", - "\n", - "format_fig(fig)" - ] - } - ], - "metadata": { - "colab": { - "provenance": [] - }, - "kernelspec": { - "display_name": "Python 3", - "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.9.7" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml new file mode 100644 index 000000000..0641fddee --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml @@ -0,0 +1,46 @@ +- name: Single person under 25, eligible for housing benefit + period: 2023 + input: + age: 24 + benunit_rent: 30*52 + is_single_person: true + in_social_housing: true + housing_benefit_reported: true + employment_income: 2000 + output: + housing_benefit: 30*52 +- name: Single person over 25, not eligible for housing benefit + period: 2023 + input: + age: 28 + benunit_rent: 30*52 + is_single_person: true + in_social_housing: false + housing_benefit_reported: 0 + employment_income: 2000 + output: + housing_benefit: 0 +- name: Lone parent with small earnings + period: 2023 + input: + age: 26 + benunit_rent: 30*52 + is_lone_parent: true + tenure_type: RENT_FROM_COUNCIL + housing_benefit_reported: true + employment_income: 0 + output: + housing_benefit: 30*52 +- name: Single person over pension age + period: 2023 + input: + age: 68 + gender: MALE + benunit_rent: 80*52 + housing_benefit_reported: true + LHA_eligible: true + is_SP_age: true + is_single_person: true + pension_income: 200*52 + output: + housing_benefit: 80*52 From afe6059ba1e0613f2e5c0248b82d714313f26eb5 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 15 Feb 2024 09:39:18 -0500 Subject: [PATCH 17/20] add test case with partial eligibility --- .../dwp/pension_credit/housing_benefit.yaml | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml index 0641fddee..afec1664b 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml @@ -1,36 +1,56 @@ -- name: Single person under 25, eligible for housing benefit +- name: Single person eligible for housing benefit period: 2023 + absolute_error_margin: 5 input: - age: 24 - benunit_rent: 30*52 + age: 28 + benunit_rent: 80*52 is_single_person: true in_social_housing: true housing_benefit_reported: true + working_tax_credit_reported: true employment_income: 2000 output: - housing_benefit: 30*52 -- name: Single person over 25, not eligible for housing benefit + housing_benefit: 80*52 +- name: Single person not eligible for housing benefit period: 2023 + absolute_error_margin: 5 input: age: 28 - benunit_rent: 30*52 + benunit_rent: 80*52 is_single_person: true in_social_housing: false housing_benefit_reported: 0 + working_tax_credit_reported: false employment_income: 2000 output: housing_benefit: 0 +- name: Single person partial eligible for housing benefit + period: 2023 + absolute_error_margin: 5 + input: + age: 28 + weekly_hours: 31 + benunit_rent: 80*52 + is_single_person: true + in_social_housing: true + is_household_head: true + housing_benefit_reported: true + working_tax_credit_reported: true + employment_income: 6000 + output: + housing_benefit: 45.86*52 - name: Lone parent with small earnings period: 2023 + absolute_error_margin: 5 input: age: 26 - benunit_rent: 30*52 + benunit_rent: 80*52 is_lone_parent: true tenure_type: RENT_FROM_COUNCIL housing_benefit_reported: true employment_income: 0 output: - housing_benefit: 30*52 + housing_benefit: 80*52 - name: Single person over pension age period: 2023 input: From 5b59c85ce7e4fe97c0270f3a9b630912023ea018 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 29 Feb 2024 03:30:40 -0500 Subject: [PATCH 18/20] adjust the error margin --- .../dwp/pension_credit/housing_benefit.yaml | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml index afec1664b..d12ba9c16 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml @@ -1,47 +1,50 @@ - name: Single person eligible for housing benefit + # Source: https://www.entitledto.co.uk/benefits-calculator/Results/ComprehensiveCalc?cid=6ea29422-0999-4439-8047-b43ac444acb9&paymentPeriod=Weekly&calcScenario=CurrentSystem period: 2023 - absolute_error_margin: 5 + absolute_error_margin: 15 input: age: 28 + weekly_hours: 26 benunit_rent: 80*52 is_single_person: true - in_social_housing: true + tenure_type: RENT_FROM_COUNCIL housing_benefit_reported: true - working_tax_credit_reported: true employment_income: 2000 output: housing_benefit: 80*52 - name: Single person not eligible for housing benefit + # Source: https://www.entitledto.co.uk/benefits-calculator/Results/ComprehensiveCalc?cid=995817cb-b6f2-4350-825f-14f3e5a71265&paymentPeriod=Weekly&calcScenario=UniversalCredit period: 2023 - absolute_error_margin: 5 + absolute_error_margin: 15 input: age: 28 + weekly_hours: 26 benunit_rent: 80*52 is_single_person: true in_social_housing: false - housing_benefit_reported: 0 - working_tax_credit_reported: false + housing_benefit_reported: false employment_income: 2000 output: housing_benefit: 0 - name: Single person partial eligible for housing benefit + # Source: https://www.entitledto.co.uk/benefits-calculator/Results/ComprehensiveCalc?cid=08fab4da-9c8b-4866-b126-61ca8159baed&paymentPeriod=Weekly&calcScenario=CurrentSystem period: 2023 - absolute_error_margin: 5 + absolute_error_margin: 15 input: age: 28 - weekly_hours: 31 + weekly_hours: 26 benunit_rent: 80*52 is_single_person: true - in_social_housing: true is_household_head: true + tenure_type: RENT_FROM_COUNCIL housing_benefit_reported: true - working_tax_credit_reported: true employment_income: 6000 output: - housing_benefit: 45.86*52 + housing_benefit: 58.3*52 - name: Lone parent with small earnings + # Source: https://www.entitledto.co.uk/benefits-calculator/Results/ComprehensiveCalc?cid=6b6f49eb-8054-47d8-90d5-0f74e23b89cb&paymentPeriod=Weekly&calcScenario=CurrentSystem period: 2023 - absolute_error_margin: 5 + absolute_error_margin: 15 input: age: 26 benunit_rent: 80*52 @@ -52,15 +55,15 @@ output: housing_benefit: 80*52 - name: Single person over pension age + # Source: https://www.entitledto.co.uk/benefits-calculator/Results/ComprehensiveCalc?cid=0e7190d3-6662-4653-b9d8-1836077df2b1&paymentPeriod=Weekly&calcScenario=CurrentSystem period: 2023 input: age: 68 gender: MALE benunit_rent: 80*52 + tenure_type: RENT_FROM_COUNCIL housing_benefit_reported: true - LHA_eligible: true - is_SP_age: true is_single_person: true - pension_income: 200*52 + pension_income: 100*52 output: housing_benefit: 80*52 From db729019ff3cf15540134e0739e9a678b2e4e1e2 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 29 Feb 2024 04:08:23 -0500 Subject: [PATCH 19/20] adjust the error margin --- .../policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml index d12ba9c16..992d10df6 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml @@ -67,3 +67,4 @@ pension_income: 100*52 output: housing_benefit: 80*52 + From ec60a77efdb85086fc064d2317b86bec1281b529 Mon Sep 17 00:00:00 2001 From: xiwang Date: Thu, 29 Feb 2024 10:51:47 -0500 Subject: [PATCH 20/20] adjust the error margin --- .../policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml index 992d10df6..a9eab1d75 100644 --- a/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/dwp/pension_credit/housing_benefit.yaml @@ -67,4 +67,4 @@ pension_income: 100*52 output: housing_benefit: 80*52 - + \ No newline at end of file