From 8df28500f973b271142e1563fb60fab93c9a2cfb Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Wed, 3 Dec 2025 18:16:14 -0500 Subject: [PATCH] Zero out fuel spending for non-fuel households MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Households with has_fuel_consumption=0 (non-vehicle owners or EV owners) now have petrol_spending and diesel_spending set to zero after imputation. This prevents the QRF from assigning fuel spending based on other predictors to households that shouldn't have any. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- changelog_entry.yaml | 4 ++++ docs/imputations.md | 2 ++ policyengine_uk_data/datasets/imputations/consumption.py | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..5b6a324ca 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + fixed: + - Zero out fuel spending for households without fuel consumption diff --git a/docs/imputations.md b/docs/imputations.md index 63c15df42..9e6964ed3 100644 --- a/docs/imputations.md +++ b/docs/imputations.md @@ -106,6 +106,8 @@ LCFS 2-week diaries undercount fuel purchasers (58%) compared to actual vehicle 4. **At FRS imputation time**: Compute `has_fuel_consumption` directly from `num_vehicles` (already calibrated to NTS targets) +5. **Zero non-fuel households**: After imputation, set `petrol_spending` and `diesel_spending` to zero for households where `has_fuel_consumption = 0` + This ensures fuel duty incidence aligns with actual vehicle ownership (~70% of households = 78% vehicles × 90% ICE) rather than LCFS diary randomness. --- diff --git a/policyengine_uk_data/datasets/imputations/consumption.py b/policyengine_uk_data/datasets/imputations/consumption.py index 49d4127c5..34cbdc8bf 100644 --- a/policyengine_uk_data/datasets/imputations/consumption.py +++ b/policyengine_uk_data/datasets/imputations/consumption.py @@ -344,6 +344,12 @@ def impute_consumption(dataset: UKSingleYearDataset) -> UKSingleYearDataset: for column in output_df.columns: dataset.household[column] = output_df[column].values + # Zero out fuel spending for households without fuel consumption + # This ensures only ICE vehicle owners contribute to fuel duty + no_fuel = has_fuel_consumption == 0 + dataset.household["petrol_spending"][no_fuel] = 0 + dataset.household["diesel_spending"][no_fuel] = 0 + dataset.validate() return dataset