Skip to content

Commit e336692

Browse files
MaxGhenisclaude
andcommitted
Remove birth_year from FRS dataset generation
birth_year should be calculated from age and period in the model, not stored as static data in the dataset. This allows birth_year to properly update in multi-year projections. With static birth_year in the dataset: - 2026: birth_year stays 2006-2023 (based on 2023 survey) - 2029: birth_year stays 2006-2023 (incorrect) By calculating birth_year = period.year - age: - 2026: birth_year becomes 2009-2026 (correct for 2026) - 2029: birth_year becomes 2012-2029 (correct for 2029) This fix is required for PolicyEngine/policyengine-uk#1352 to work correctly and ensure two-child limit cost projections increase over time as expected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b693e54 commit e336692

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

changelog_entry.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- bump: patch
2+
changes:
3+
changed:
4+
- Remove birth_year from FRS dataset generation to allow dynamic calculation

policyengine_uk_data/datasets/frs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def create_frs(
110110
# Add basic personal variables
111111
age = person.age80 + person.age
112112
pe_person["age"] = age
113-
pe_person["birth_year"] = np.ones_like(person.age) * (year - age)
113+
# birth_year should be calculated from age and period in the model,
114+
# not stored as static data (see PolicyEngine/policyengine-uk#1352)
114115
# Age fields are AGE80 (top-coded) and AGE in the adult and child tables, respectively.
115116
pe_person["gender"] = np.where(person.sex == 1, "MALE", "FEMALE")
116117
pe_person["hours_worked"] = np.maximum(person.tothours, 0) * 52

0 commit comments

Comments
 (0)