Skip to content

Commit 2ffa4e6

Browse files
committed
Improve corporate land allocation
1 parent 167771b commit 2ffa4e6

4 files changed

Lines changed: 83 additions & 4 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed `corporate_land_value` to allocate aggregate corporate land using the current weighted distribution of `corporate_wealth`, and refreshed the aggregate land parameters to the 2024 ONS land totals used by `policyengine-uk-data`.

policyengine_uk/parameters/household/wealth/land/value.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ aggregate_household_land_value:
88
2018-01-01: 3_947_306_000_000
99
2019-01-01: 3_961_152_000_000
1010
2020-01-01: 4_309_138_000_000
11+
2024-01-01: 5_041_350_906_096
12+
2025-01-01: 5_041_350_906_096
13+
2026-01-01: 5_041_350_906_096
1114
metadata:
1215
unit: currency-GBP
1316
label: Total direct household land value
@@ -25,6 +28,9 @@ aggregate_corporate_land_value:
2528
2018-01-01: 1_695_825_000_000
2629
2019-01-01: 1_683_117_000_000
2730
2020-01-01: 1_757_818_000_000
31+
2024-01-01: 2_058_649_093_904
32+
2025-01-01: 2_058_649_093_904
33+
2026-01-01: 2_058_649_093_904
2834
metadata:
2935
unit: currency-GBP
3036
label: Total corporate land value
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from policyengine_uk import Simulation
2+
import pytest
3+
4+
5+
def test_corporate_land_value_matches_aggregate_for_weighted_dataset():
6+
sim = Simulation(
7+
situation={
8+
"people": {
9+
"person_1": {"age": {2025: 40}},
10+
"person_2": {"age": {2025: 50}},
11+
},
12+
"benunits": {
13+
"benunit_1": {"members": ["person_1"]},
14+
"benunit_2": {"members": ["person_2"]},
15+
},
16+
"households": {
17+
"household_1": {
18+
"members": ["person_1"],
19+
"corporate_wealth": {2025: 100_000},
20+
"household_weight": {2025: 2},
21+
},
22+
"household_2": {
23+
"members": ["person_2"],
24+
"corporate_wealth": {2025: 300_000},
25+
"household_weight": {2025: 1},
26+
},
27+
},
28+
}
29+
)
30+
31+
corporate_land_value = sim.calculate(
32+
"corporate_land_value", map_to="household", period=2025
33+
)
34+
household_weight = sim.calculate("household_weight", map_to="household", period=2025)
35+
aggregate = (
36+
sim.tax_benefit_system.parameters("2025")
37+
.household.wealth.land.value.aggregate_corporate_land_value
38+
)
39+
40+
assert corporate_land_value[0] == pytest.approx(aggregate * 0.2)
41+
assert corporate_land_value[1] == pytest.approx(aggregate * 0.6)
42+
assert (corporate_land_value * household_weight).sum() == pytest.approx(aggregate)
43+
44+
45+
def test_corporate_land_value_is_zero_without_corporate_wealth():
46+
sim = Simulation(
47+
situation={
48+
"people": {"person": {"age": {2025: 40}}},
49+
"benunits": {"benunit": {"members": ["person"]}},
50+
"households": {
51+
"household": {
52+
"members": ["person"],
53+
"corporate_wealth": {2025: 0},
54+
"household_weight": {2025: 1},
55+
}
56+
},
57+
}
58+
)
59+
60+
corporate_land_value = sim.calculate(
61+
"corporate_land_value", map_to="household", period=2025
62+
)
63+
64+
assert corporate_land_value[0] == 0

policyengine_uk/variables/household/wealth/corporate_land_value.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ class corporate_land_value(Variable):
1111
quantity_type = STOCK
1212

1313
def formula(household, period, parameters):
14-
wealth = parameters(period).household.wealth
1514
corporate_wealth = household("corporate_wealth", period)
16-
corporate_wealth_intensity = (
17-
wealth.land.value.aggregate_corporate_land_value / wealth.corporate_wealth
15+
household_weight = household("household_weight", period)
16+
total_weighted_corporate_wealth = (corporate_wealth * household_weight).sum()
17+
if total_weighted_corporate_wealth == 0:
18+
return corporate_wealth * 0
19+
20+
aggregate_corporate_land_value = (
21+
parameters(period).household.wealth.land.value.aggregate_corporate_land_value
22+
)
23+
return (
24+
corporate_wealth
25+
/ total_weighted_corporate_wealth
26+
* aggregate_corporate_land_value
1827
)
19-
return corporate_wealth * corporate_wealth_intensity

0 commit comments

Comments
 (0)