euromod_linking.methods.lma_labour_alignment.scoring¶
Transition scoring: four logit models ranking who transitions first.
Economic intuition¶
The macro model says how many people change state per cell; these logits decide who. Each model fits the cross-sectional probability of currently being in a state (employed, unemployed, active, unemployed-given-active) on standard labour-supply determinants — age, gender, disability income (yds, a strong participation barrier), marital-status dummies. The fitted probability is used as a propensity ranking: someone who looks like the currently employed is assumed the most likely marginal entrant into employment, and vice versa. Selecting movers by this ranking concentrates transitions on plausible individuals, which is what makes the downstream distributional results (who gains income, whose benefits change) meaningful.
This is deliberately an ordering device, not a causal transition model: only the ranks matter, coefficients are never interpreted, and the same fit is reused for every period so period comparisons differ only in targets.
Fixed methodology (feature set, model form) — not scenario-configurable. Deterministic: fixed feature ordering, sorted dummy columns; statsmodels’ Newton solver is deterministic given identical inputs.
Caching¶
The fit depends only on the observed population — features and current labour states — and never on shocks, targets, cells or periods. So the same four models are refitted identically for every scenario on a dataset: a 10-period sweep would pay for 40 logit fits that all produce the same numbers. The scores are therefore cached, keyed on a content hash of the exact input columns used (plus SCORING_VERSION, so a change of feature set or model form invalidates every stored score). Content addressing means the cache cannot go stale: different data — even the same file re-generated — hashes differently and refits. In-memory for the process, and optionally persisted to disk (EUROMOD_SCORE_CACHE_DIR) so a new process does not refit.
Attributes¶
Functions¶
|
|
|
Drop in-memory scores (disk entries are content-addressed and harmless). |
|
Add PROB_COLUMNS to df (rows = the alignment population, with binary |
|
Content hash of the scoring inputs (index + feature/outcome values). |
Module Contents¶
- euromod_linking.methods.lma_labour_alignment.scoring.clear_cache() None[source]¶
Drop in-memory scores (disk entries are content-addressed and harmless).
- euromod_linking.methods.lma_labour_alignment.scoring.estimate_probabilities(df: pandas.DataFrame, use_cache: bool = True) tuple[pandas.DataFrame, dict][source]¶
Add PROB_COLUMNS to df (rows = the alignment population, with binary status columns employed/unemployed/active already present).
Returns (scored_df, info) where info reports whether the scores came from the cache. Identical inputs are served without refitting.
- euromod_linking.methods.lma_labour_alignment.scoring.fingerprint(df: pandas.DataFrame) str | None[source]¶
Content hash of the scoring inputs (index + feature/outcome values).
Includes the index so a hit guarantees the cached scores align row-for-row with the caller’s frame. Returns None if the frame cannot be hashed, in which case the caller simply refits.
- euromod_linking.methods.lma_labour_alignment.scoring.PROB_COLUMNS = ('prob_employed', 'prob_unemployed', 'prob_active', 'prob_unemp_if_active')¶
- euromod_linking.methods.lma_labour_alignment.scoring.SCORING_VERSION = 1¶