Skip to content

Commit 19e7d41

Browse files
authored
Merge pull request #1583 from PolicyEngine/codex/improve-corporate-land
Improve corporate land allocation
2 parents 809a237 + 72c2f90 commit 19e7d41

4 files changed

Lines changed: 90 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ 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+
2021-01-01: 5_047_690_687_279
12+
2022-01-01: 5_070_355_908_968
13+
2023-01-01: 4_798_764_603_941
14+
2024-01-01: 5_041_350_906_096
15+
2025-01-01: 5_041_350_906_096
16+
2026-01-01: 5_041_350_906_096
1117
metadata:
1218
unit: currency-GBP
1319
label: Total direct household land value
@@ -25,6 +31,12 @@ aggregate_corporate_land_value:
2531
2018-01-01: 1_695_825_000_000
2632
2019-01-01: 1_683_117_000_000
2733
2020-01-01: 1_757_818_000_000
34+
2021-01-01: 2_059_094_312_721
35+
2022-01-01: 2_068_340_091_032
36+
2023-01-01: 1_957_550_396_059
37+
2024-01-01: 2_058_649_093_904
38+
2025-01-01: 2_058_649_093_904
39+
2026-01-01: 2_058_649_093_904
2840
metadata:
2941
unit: currency-GBP
3042
label: Total corporate land value
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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(
35+
"household_weight", map_to="household", period=2025
36+
)
37+
aggregate = sim.tax_benefit_system.parameters(
38+
"2025"
39+
).household.wealth.land.value.aggregate_corporate_land_value
40+
41+
assert corporate_land_value[0] == pytest.approx(aggregate * 0.2)
42+
assert corporate_land_value[1] == pytest.approx(aggregate * 0.6)
43+
assert (corporate_land_value * household_weight).sum() == pytest.approx(aggregate)
44+
45+
46+
def test_corporate_land_value_is_zero_without_corporate_wealth():
47+
sim = Simulation(
48+
situation={
49+
"people": {"person": {"age": {2025: 40}}},
50+
"benunits": {"benunit": {"members": ["person"]}},
51+
"households": {
52+
"household": {
53+
"members": ["person"],
54+
"corporate_wealth": {2025: 0},
55+
"household_weight": {2025: 1},
56+
}
57+
},
58+
}
59+
)
60+
61+
corporate_land_value = sim.calculate(
62+
"corporate_land_value", map_to="household", period=2025
63+
)
64+
65+
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 = parameters(
21+
period
22+
).household.wealth.land.value.aggregate_corporate_land_value
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)