Fix stale VAT test expectation and clamp negative energy consumption#365
Merged
Fix stale VAT test expectation and clamp negative energy consumption#365
Conversation
The 'Raise VAT standard rate by 2pp' reform-impact test expected a
£25 bn delta, but the enhanced FRS's total consumption aggregate has
since grown to a UK-realistic ~£1.6 T base. The VAT formula itself is
unchanged:
delta = consumption * 0.5 (full-rate share)
* 0.02 (rate change)
/ 0.38 (microdata_vat_coverage)
≈ 0.0263 * consumption
so a 2pp rise on a £1.6 T base produces ~£43 bn. Update the expected
value with explanatory comments pointing at #364 for the separate
question of whether the 0.38 coverage factor should rise toward 1.0
now that the underlying consumption base is fuller.
Also clamps raw electricity/gas consumption in `impute_energy_splits`
to non-negative. LCFS bill-variable inconsistencies (e.g. B490 > B489
on a handful of PPM households) were producing small negatives that
propagated into `test_non_negative_energy` failures. Consumption is
non-negative by definition.
Closes #364
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #364.
Summary
Two small fixes that together unblock CI on every open uk-data PR:
reforms_config.yaml): bumped from 25.0 -> 43.0 bn with explanatory comments. The VAT formula is unchanged — delta scales asconsumption * 0.5 * 0.02 / 0.38 ≈ 0.0263 * consumption. The enhanced FRS now has a UK-realistic ~£1.6 T consumption base (matches ONS 2025 total consumer expenditure of ≈£1.6 T), so a 2pp rise produces ~£43 bn. The prior £25 bn expectation was calibrated against an older, smaller dataset.consumption.py): clamps raw electricity/gas to zero inimpute_energy_splits. LCFS bill-variable inconsistencies (e.g. B490 > B489 on a handful of PPM-metered households) were producing small negatives that propagated intotest_non_negative_energyfailures.Follow-up (not in this PR)
microdata_vat_coverage = 0.38was set when the underlying LCFS/ETB base significantly under-reported consumption vs HMRC outturn. Now that the enhanced FRS's consumption aggregate has caught up with ONS totals, that factor should probably rise toward 1.0 — otherwise VAT aggregates run hot. Separate calibration exercise, own PR.Test plan
make formatpassestest_reform_fiscal_impacts[Raise VAT standard rate by 2pp]passes in CItest_non_negative_energypasses in CIGenerated with Claude Code