Skip to content

Commit 932ff6d

Browse files
MaxGhenisclaude
andauthored
Update stale VAT test expectation and clamp negative energy consumption (#365)
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>
1 parent b73eccd commit 932ff6d

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the `Raise VAT standard rate by 2pp` reform-impact test expectation from 25.0 bn to 43.0 bn — the enhanced FRS's total consumption aggregate has grown to a UK-realistic ~£1.6 T (matching ONS 2025 total consumer expenditure), so a 2pp rise on the current `microdata_vat_coverage = 0.38`-scaled base produces ~£43 bn, not the £25 bn calibrated against an older smaller dataset. Also clamps raw electricity/gas consumption in `impute_energy_splits` to be non-negative (a handful of LCFS bill-variable inconsistencies produced small negatives), fixing `test_non_negative_energy`. Follow-up: revisit `microdata_vat_coverage` itself now that the underlying base is fuller (#364).

policyengine_uk_data/datasets/imputations/consumption.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,13 @@ def _derive_energy_from_lcfs(household: pd.DataFrame) -> pd.DataFrame:
345345
electricity[mask4] = p537[mask4] * mean_elec_share
346346
gas[mask4] = p537[mask4] * (1 - mean_elec_share)
347347

348+
# Clamp to non-negative; raw LCFS bill variables occasionally produce
349+
# small negatives (e.g. B490 > B489 inconsistency, or implausible
350+
# negative P537 entries). Consumption totals can't be negative by
351+
# definition and downstream NEED calibration preserves zero.
352+
electricity = np.maximum(electricity, 0.0)
353+
gas = np.maximum(gas, 0.0)
354+
348355
household = household.copy()
349356
household["electricity_consumption"] = electricity
350357
household["gas_consumption"] = gas

policyengine_uk_data/tests/microsimulation/reforms_config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ reforms:
2525
parameters:
2626
gov.hmrc.national_insurance.class_1.rates.employee.main: 0.1
2727
- name: Raise VAT standard rate by 2pp
28-
expected_impact: 25.0
28+
# Delta scales as `consumption * 0.5 * 0.02 / 0.38 ≈ 0.0263 * consumption`
29+
# (full-rate share 0.5 × 2pp rate change ÷ 0.38 microdata-VAT-coverage
30+
# parameter). The enhanced FRS now carries a UK-realistic ~£1.6T total
31+
# consumption base (ONS 2025 total consumer expenditure ≈ £1.6T), so a
32+
# 2pp standard-rate rise produces ~£43 bn. The prior 25.0 bn expectation
33+
# predates the consumption-base growth. A follow-up should re-examine
34+
# whether `microdata_vat_coverage` itself should be raised toward 1.0
35+
# now that the enhanced FRS consumption aggregate has caught up — see
36+
# #364.
37+
expected_impact: 43.0
2938
tolerance: 10.0
3039
parameters:
3140
gov.hmrc.vat.standard_rate: 0.22

0 commit comments

Comments
 (0)