From e29a512377edf612b4d1736db08ecca173daa7ed Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:37:23 +0000 Subject: [PATCH] Add fuel duty revenue projections and increase imputation granularity (#831) * Add docker step * Versioning * Remove push action from PRs * Add requirements.txt * Update carbon tax intensities for 2024 data * Versioning * Temporarily suspend fuel duty parameters * Add fuel duty revenues * Versioning * Fix tests * Reduce consumer incidence --- changelog_entry.yaml | 4 +++ .../data/datasets/frs/enhanced_frs.py | 2 +- .../datasets/frs/imputations/consumption.py | 28 +++++++++++++++++++ .../imputations/consumption_targets.yaml | 4 +-- .../programs/fuel_duty/revenue.yaml | 16 +++++++++++ .../gov/hmrc/fuel_duty/fuel_duty.yaml | 12 ++++---- .../reforms/parametric/fuel_duty_cut.yaml | 6 ++-- .../variables/gov/hmrc/fuel_duty/fuel_duty.py | 2 +- 8 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 policyengine_uk/parameters/calibration/programs/fuel_duty/revenue.yaml diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..5e71b384a 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Fuel duty revenue projections diff --git a/policyengine_uk/data/datasets/frs/enhanced_frs.py b/policyengine_uk/data/datasets/frs/enhanced_frs.py index 9a536c413..87bb8531d 100644 --- a/policyengine_uk/data/datasets/frs/enhanced_frs.py +++ b/policyengine_uk/data/datasets/frs/enhanced_frs.py @@ -86,7 +86,7 @@ def generate(self): target_values, X_input, frs_household_weight, - max_iterations=5, + max_iterations=8, ) else: quantiles = None diff --git a/policyengine_uk/data/datasets/frs/imputations/consumption.py b/policyengine_uk/data/datasets/frs/imputations/consumption.py index 3383f7286..692779875 100644 --- a/policyengine_uk/data/datasets/frs/imputations/consumption.py +++ b/policyengine_uk/data/datasets/frs/imputations/consumption.py @@ -104,6 +104,33 @@ def generate_lcfs_table( ].dropna() +def uprate_lcfs_table( + household: pd.DataFrame, time_period: str +) -> pd.DataFrame: + from policyengine_uk.system import system + + fuel_duty_revenue = ( + system.parameters.calibration.programs.fuel_duty.revenue + ) + fuel_duty_rate = system.parameters.gov.hmrc.fuel_duty.petrol_and_diesel + start_period = 2020 + start_index = fuel_duty_revenue(start_period) / fuel_duty_rate( + start_period + ) + end_index = fuel_duty_revenue(time_period) / fuel_duty_rate(time_period) + fuel_uprating = end_index / start_index + household["petrol_spending"] *= fuel_uprating + household["diesel_spending"] *= fuel_uprating + + cpi = system.parameters.calibration.uprating.CPI + cpi_uprating = cpi(time_period) / cpi(start_period) + + for variable in IMPUTATIONS: + if variable not in ["petrol_spending", "diesel_spending"]: + household[variable] *= cpi_uprating + return household + + def save_imputation_models(): consumption = Imputation() lcfs_household = pd.read_csv( @@ -115,6 +142,7 @@ def save_imputation_models(): LCFS_TAB_FOLDER / "lcfs_2020_dvper_ukanon202021.tab", delimiter="\t" ) household = generate_lcfs_table(lcfs_person, lcfs_household) + household = uprate_lcfs_table(household, "2023") consumption.train( household[PREDICTOR_VARIABLES], household[IMPUTATIONS], diff --git a/policyengine_uk/data/storage/imputations/consumption_targets.yaml b/policyengine_uk/data/storage/imputations/consumption_targets.yaml index 428f29482..d3934b7fb 100644 --- a/policyengine_uk/data/storage/imputations/consumption_targets.yaml +++ b/policyengine_uk/data/storage/imputations/consumption_targets.yaml @@ -1,7 +1,7 @@ alcohol_and_tobacco_consumption: 20649078205.153564 clothing_and_footwear_consumption: 20963698388.085712 communication_consumption: 16271364314.480564 -diesel_spending: 6376596007.607264 +diesel_spending: 8267208905.41007 domestic_energy_consumption: 34019184412.316296 education_consumption: 12218834004.851433 food_and_non_alcoholic_beverages_consumption: 101271123549.67178 @@ -9,7 +9,7 @@ health_consumption: 9779703005.577099 household_furnishings_consumption: 50520352854.88441 housing_water_and_electricity_consumption: 124038611200.9107 miscellaneous_consumption: 54415069695.58299 -petrol_spending: 10060152807.35514 +petrol_spending: 13042912673.083202 recreation_consumption: 65969989192.65327 restaurants_and_hotels_consumption: 26464397527.409103 transport_consumption: 89217063076.27383 diff --git a/policyengine_uk/parameters/calibration/programs/fuel_duty/revenue.yaml b/policyengine_uk/parameters/calibration/programs/fuel_duty/revenue.yaml new file mode 100644 index 000000000..ca5f9f6c7 --- /dev/null +++ b/policyengine_uk/parameters/calibration/programs/fuel_duty/revenue.yaml @@ -0,0 +1,16 @@ +description: Fuel duty revenues. +values: + 2020-01-01: 20_934_000_000 + 2021-01-01: 25_943_000_000 + 2022-01-01: 24_799_033_375 + 2023-01-01: 24_799_033_375 + 2024-01-01: 24_348_775_447 + 2025-01-01: 26_621_382_708 + 2026-01-01: 26_262_427_712 + 2027-01-01: 26_034_425_644 +metadata: + unit: currency-GBP + label: Fuel duty revenues + reference: + - title: OBR forecast + href: https://obr.uk/forecasts-in-depth/tax-by-tax-spend-by-spend/fuel-duties \ No newline at end of file diff --git a/policyengine_uk/tests/policy/baseline/gov/hmrc/fuel_duty/fuel_duty.yaml b/policyengine_uk/tests/policy/baseline/gov/hmrc/fuel_duty/fuel_duty.yaml index 9c6e6f815..e4c6a5a6d 100644 --- a/policyengine_uk/tests/policy/baseline/gov/hmrc/fuel_duty/fuel_duty.yaml +++ b/policyengine_uk/tests/policy/baseline/gov/hmrc/fuel_duty/fuel_duty.yaml @@ -1,13 +1,13 @@ - name: Petrol only in 2022. period: 2022 - absolute_error_margin: 0.1 + absolute_error_margin: 1 input: petrol_spending: 1_200 diesel_spending: 0 output: - petrol_litres: 1200 / 1.491 + petrol_litres: 1200 / 1.4910 diesel_litres: 0 - fuel_duty: 804.83 / 0.508 * 0.5795 + fuel_duty: 1322 - name: No fuel spending, no fuel duty. period: 2023 absolute_error_margin: 0.1 @@ -26,8 +26,8 @@ diesel_spending: 350 output: petrol_litres: 800 / 1.6703 - diesel_litres: 350 / 1.7897 - fuel_duty: (478.96 + 195.56) / 0.508 * 0.5295 + diesel_litres: 350 / 1.4559 + fuel_duty: (478.96 + 240.40) / 0.33 * 0.5295 - name: Petrol and diesel in 2021. period: 2021 absolute_error_margin: 0.1 @@ -37,5 +37,5 @@ output: petrol_litres: 800 / 1.0669 diesel_litres: 350 / 1.1186 - fuel_duty: (749.84 + 312.89) / 0.508 * 0.5795 + fuel_duty: (749.84 + 312.89) / 0.33 * 0.5795 \ No newline at end of file diff --git a/policyengine_uk/tests/policy/reforms/parametric/fuel_duty_cut.yaml b/policyengine_uk/tests/policy/reforms/parametric/fuel_duty_cut.yaml index 79f66a0bd..2bf433e7a 100644 --- a/policyengine_uk/tests/policy/reforms/parametric/fuel_duty_cut.yaml +++ b/policyengine_uk/tests/policy/reforms/parametric/fuel_duty_cut.yaml @@ -4,7 +4,7 @@ input: petrol_spending: 100 output: - fuel_duty: 54.32 / 0.51 + fuel_duty: 54.32 / 0.33 - name: Reduction from 5p cut period: 2021 @@ -12,6 +12,6 @@ input: gov.hmrc.fuel_duty.petrol_and_diesel: 0.5295 petrol_spending: 100 - baseline_fuel_duty: 54.32 / 0.51 + baseline_fuel_duty: 54.32 / 0.33 output: - change_in_fuel_duty: -5 / 0.51 \ No newline at end of file + change_in_fuel_duty: -5 / 0.33 \ No newline at end of file diff --git a/policyengine_uk/variables/gov/hmrc/fuel_duty/fuel_duty.py b/policyengine_uk/variables/gov/hmrc/fuel_duty/fuel_duty.py index bf8568d23..db7af6581 100644 --- a/policyengine_uk/variables/gov/hmrc/fuel_duty/fuel_duty.py +++ b/policyengine_uk/variables/gov/hmrc/fuel_duty/fuel_duty.py @@ -1,7 +1,7 @@ from policyengine_uk.model_api import * -STATUTORY_CONSUMER_INCIDENCE = 0.508 +STATUTORY_CONSUMER_INCIDENCE = 0.33 ECONOMIC_CONSUMER_INCIDENCE = 1