Skip to content

Commit da07f89

Browse files
Merge pull request #272 from PolicyEngine/highest-education
Add highest_education from FRS EDUCQUAL
2 parents 1966f53 + 1417c27 commit da07f89

3 files changed

Lines changed: 57 additions & 0 deletions

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: minor
2+
changes:
3+
added:
4+
- highest_education variable derived from FRS EDUCQUAL field.

policyengine_uk_data/datasets/frs.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,50 @@ def determine_education_level(fted_val, typeed2_val, age_val):
207207
index=pe_person.index,
208208
)
209209

210+
# Add highest education from EDUCQUAL (highest qualification achieved)
211+
# Codes from FRS ADT_324X classification; unmapped codes default to UPPER_SECONDARY
212+
EDUCQUAL_MAP = {
213+
1: "NOT_COMPLETED_PRIMARY",
214+
2: "LOWER_SECONDARY", # GCSE D-G / CSE 2-5
215+
3: "LOWER_SECONDARY", # GCSE A-C / O-level A-C
216+
4: "UPPER_SECONDARY", # AS-level
217+
5: "UPPER_SECONDARY", # A-level (1 subject)
218+
6: "UPPER_SECONDARY", # A-level (2 subjects)
219+
7: "UPPER_SECONDARY", # A-level (3+ subjects)
220+
8: "LOWER_SECONDARY", # Scottish Standard/Ordinary Grade
221+
9: "UPPER_SECONDARY", # Scottish Higher Grade
222+
10: "UPPER_SECONDARY", # Scottish 6th Year Studies
223+
11: "POST_SECONDARY", # HNC/HND
224+
12: "POST_SECONDARY", # City & Guilds advanced / BTEC National
225+
13: "UPPER_SECONDARY", # City & Guilds craft / BTEC General
226+
14: "POST_SECONDARY", # ONC/OND / BTEC National (lower)
227+
15: "UPPER_SECONDARY", # City & Guilds foundation
228+
16: "POST_SECONDARY", # RSA advanced
229+
17: "TERTIARY", # First/foundation degree
230+
18: "TERTIARY", # Second degree
231+
19: "TERTIARY", # Higher degree (Masters/PhD)
232+
20: "TERTIARY", # PGCE / teaching qualification
233+
21: "TERTIARY", # Nursing/paramedical qualification
234+
66: "UPPER_SECONDARY", # NVQ/SVQ Level 1
235+
67: "UPPER_SECONDARY", # NVQ/SVQ Level 2
236+
68: "UPPER_SECONDARY", # NVQ/SVQ Level 3
237+
69: "POST_SECONDARY", # NVQ/SVQ Level 4
238+
70: "TERTIARY", # NVQ/SVQ Level 5
239+
}
240+
# Codes 22-65 and 71-85 are further vocational/professional qualifications;
241+
# treat as POST_SECONDARY. Codes 86-87 are catch-alls; treat as UPPER_SECONDARY.
242+
for code in range(22, 66):
243+
EDUCQUAL_MAP[code] = "POST_SECONDARY"
244+
for code in range(71, 86):
245+
EDUCQUAL_MAP[code] = "POST_SECONDARY"
246+
EDUCQUAL_MAP[86] = "UPPER_SECONDARY"
247+
EDUCQUAL_MAP[87] = "UPPER_SECONDARY"
248+
249+
educqual = pd.to_numeric(person.educqual, errors="coerce")
250+
pe_person["highest_education"] = educqual.map(EDUCQUAL_MAP).fillna(
251+
"UPPER_SECONDARY"
252+
)
253+
210254
# Add employment status
211255
EMPLOYMENTS = [
212256
"CHILD",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from policyengine_uk import Microsimulation
2+
3+
4+
def test_highest_education(frs):
5+
sim = Microsimulation(dataset=frs)
6+
values = sim.calculate("highest_education", period=2025)
7+
assert "TERTIARY" in set(values)
8+
assert "LOWER_SECONDARY" in set(values)
9+
assert "UPPER_SECONDARY" in set(values)

0 commit comments

Comments
 (0)