Skip to content

UK: carry the FRS occupation (SOC 2020 major group), and redraw it on the SPI channel #1490

Closed

Description

@juaristi22

Problem

PolicyEngine/uk-ai-study#16 asks whether Microcosm can carry occupation, so that occupation-level work can run on Microcosm without the raw FRS. The study scores exposure to AI by SOC 2020 major group. The UK build carries the FRS's industry (sic_industry_division, read from adult.tab in frs_employment), but not the occupation beside it.

What the FRS holds.

  • adult.tab carries SOC2020, the SOC 2020 major group, at nine groups in the end-user edition.
  • The employment questions also go to adults not in work who have ever worked (2024-25 question instructions, p. 183; PDF p. 184). So the code is the main job for adults in work and the last job for everyone else.
  • In 2024-25, 92% of adults carry a code (weighted), and a third of them are not in work. 99.5% of adults in work have one.

SPI-channel rows would keep the wrong code.

  • spi_support_channel and spi_income_band_donors copy whole FRS households. hmrc_spi_income_spine then redraws their adults' incomes from the SPI tape, which holds no occupation.
  • So a copy would keep its twin's occupation, drawn for the twin's pay. It already keeps its twin's sic_industry_division and employment_sector that way. spi_housing_shell redraws housing for the same reason.
  • SPI-channel rows hold 42.6% of weighted workers in a recent calibrated UK build.
  • Held out on FRS 2024-25 workers, a model given only what the twin is matched on (age, sex, region and employment status) misses the occupation shares within earnings bands by 0.15 to 0.38 (total variation). Conditioning on the incomes brings this down to 0.01 to 0.05.

Proposal

1. Carry the FRS code at frs_employment.

  • Write soc2020_major_group (person, string: the policyengine-uk enum's member names) from SOC2020. Values 1000 to 9000 map to the nine major groups through SOC2020_MAJOR_GROUP_CODES, and NONE goes where the code is undefined and to child-table people.
  • Direct-index soc2020, as sic is, so a missing column fails the build.
  • Update the derived surfaces:
    • spec/sources.yaml and source_stages.json;
    • graph.py's _STAGE_CELLS;
    • terminal_gates.py, and any domain entry in gates.json;
    • the national staging build record;
    • the release input coverage manifest;
    • the H2 spine fixture;
    • test_uk_frs_employment.py and the battery bindings.
  • Leave the eFRS parity reference out, since the incumbent has no such column.
  • This needs Add soc2020_major_group, an input for the SOC 2020 major group of a person's main or last job policyengine-uk#2856 in the pinned policyengine-uk.

2. Redraw it on the drawn SPI rows, in a new person stage after company_cars. At that point the SPI rows' pay is net of car benefits, the same concept as FRS pay.

  • Rows drawn: person_is_spi_income_recipient rows whose twin has a code, or that drew positive pay or profit.
    • Every other row is byte-unchanged.
    • An undrawn copy keeps its twin's incomes, so it keeps the twin's code.
  • Training rows: FRS-channel adults aged 16 and over, with a code and positive weight, and without CGT clones or support copies (as salary_sacrifice trains). They are weighted by household_weight.
  • Predictors, present on both channels:
    • age, sex and region;
    • employment-status group (employee, self-employed, retired, other);
    • employment income, self-employment income, investment income (savings interest plus dividends) and private pension income.
  • Left out: industry, hours and education predict occupation better, but on SPI rows they are the twin's. The full-time flag is left out for the same reason.
  • Model and draw: a weighted gradient-boosted classifier, regularised with early stopping, with its settings declared in the spec. Draws are inverse-CDF on stable_identity_uniforms keyed by person_id, as spi_housing_shell draws its categories.
  • Evidence, on household-grouped folds (Calibrate the QRF sign gates out of fold, for every gated UK imputation #1391's _stratified_folds(groups=...)):
    • held-out log loss against the constant;
    • the calibration slope;
    • occupation shares within earnings bands.
  • Then work through the new-stage checklist of derived surfaces.

3. Impute the sub-major group within the major group. This writes soc2020_sub_major_group, the second input in PolicyEngine/policyengine-uk#2856.

  • Why: occupation-level work needs detail below the major group. Take the study's unit-group crosswalk, weighted by ASHE 2025 jobs:
    • Major groups explain 75% of the spread in AI exposure (C-AIOE) across jobs, and sub-major groups 86%.
    • Within major groups, exposure rises with pay, at a correlation of 0.32 across unit groups.
    • For complementarity, which the study uses to spread wage gains, the shares are 51% and 69%.
  • Donor: a survey that codes SOC 2020 below the major group, meaning the LFS or the APS (end-user editions). Which one, and which years, is still to be measured, on:
    • the sample at sub-major level;
    • pay coverage (the LFS asks about pay only at waves 1 and 5);
    • the 2021-22 SOC coding revision.
  • Rows: every adult with a major group. On FRS rows the draw is within their FRS code; on drawn SPI rows, within the redrawn code. NONE stays NONE.
  • Model and draw: a weighted classifier over the major group's sub-major groups, with keyed inverse-CDF draws as in part 2.
    • FRS rows condition on everything both surveys carry: age, sex, region, employment status, full-time status, hours, pay, industry section and highest qualification.
    • Drawn SPI rows condition only on the SPI set, since the rest is the twin's.

4. Open questions.

  • Should the stage in part 2 also copy a coherent (sic_industry_division, employment_sector) pair onto these rows, from an FRS worker with the drawn major group and the nearest pay rank? Both are the twin's today.
  • Should it fill the 0.5% of FRS adults in work who have no code, from the full predictor set, or leave them at NONE?

Prior work: #325, as a reference

#325 built an occupation and AI-exposure stack for the populace layout. It conflicts with main, so this issue treats it as a reference, not a base. Its pieces, and what happens to each here:

  • FRS occupation merge (frs_occupation.py): replaced.
    • It joins adult.tab onto a finished single-year dataset by person id, so it cannot follow cloned households (its own follow-up).
    • Part 1 reads the code where the spine reads adult.tab, so every copy carries its source person's code.
    • Its loud-failure checks (duplicate keys, a join that matches nothing) carry over as tests.
  • Exposure imputation (exposure_imputation.py): the idea stays, the method changes.
    • The idea is to refine within the observed major group from an LFS/APS donor.
    • It imputes a numeric C-AIOE score with a QRF, because the QRF cannot draw codes. Microcosm now draws categories with keyed classifiers, as spi_housing_shell does, so part 3 imputes the sub-major code instead. The dataset then does not fix one exposure measure, and users map whichever measure they need.
    • Its donor notes stay as reference: the LFS five-quarter variables, deduplicating on PERSID, the 2021-22 SOC coding revision and the EUL terms.
  • Occupation targets (occupation_targets.py and its CSVs): APS stays, ASHE changes role.
    • The APS sub-major and age margins stay, as checks first. Their facts come through Chronicle rather than CSVs in the tree.
    • ASHE's 340 unit-group job counts do not become person targets: they count employee jobs rather than people, leave out the self-employed, and fall into thin cells. ASHE stays as the pay-by-occupation check.
  • Exposure crosswalk (ai_exposure.py, ai_exposure_sources.py and the CSVs): stays out of Microcosm. It is analysis keyed on occupation codes. PolicyEngine/uk-ai-study already packages it, along with the composition question still open in UK AI-exposure analysis stack: exposure crosswalk, occupation targets, exposure imputation, and ESRI-style AI shock scenarios #325's thread.
  • Shock scenarios and runner (ai_shock_scenarios.py, ai_shock_runner.py): stay out of Microcosm, with the study's analysis in PolicyEngine/uk-ai-study.

Checks

  • Weighted workers by major and sub-major group against the APS (NOMIS) for the build year, for the UK and its regions. The tolerance is to be set. The APS facts need a Chronicle request.
  • Median full-time employee pay by major group against ASHE Table 14. This is a soft check, since the pay concepts differ.
  • The stages' held-out metrics, as stage health.

Done when

  • frs_employment writes soc2020_major_group, and every FRS-channel adult carries the survey's code.
  • Drawn SPI rows carry a redrawn code, and the stage records its held-out evidence.
  • Every adult with a major group carries a sub-major group drawn within it.
  • The pinned policyengine-uk carries both inputs, and the release carries both columns.
  • The national is rebuilt, and the APS checks pass.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions