Methods

A method — a methodology — is a reviewed implementation that turns shocks into transformed EUROMOD input plus run parameters. It is the modelling of the linkage: which people move, how they are ranked, what a new worker earns, what a growth rate multiplies.

Each one lives in its own module under euromod_linking.methods, and is referred to everywhere by its plain name.

Two ship with the package:

scale_variables

Cell-level arithmetic on input variables and income lists. Multiply, grow, add or set. Consumes scale shocks.

lma_labour_alignment

Two-level hierarchical alignment of the population to external employment and unemployment targets. Consumes align shocks.

The caller never picks one

Dispatch is from the shock table’s channels and metrics, not from a field in the scenario. A align shock on employment resolves to lma_labour_alignment; a scale shock resolves to scale_variables. The resolved reference comes back in the result.

The reason is that the alternative is silently wrong. If the caller named the methodology, the same scenario could be handled by a different method than the one that produced an earlier result, and nothing in either output would say so. Resolving from the shocks means a scenario that dispatches differently is a scenario that is different.

A consequence follows. Because the scenario never names the method, nothing in the document changes when the method itself changes — so the guard against a stale result has to live somewhere other than the scenario. registry.code_fingerprint hashes a method’s own source into the scenario fingerprint, so editing an implementation invalidates cached results rather than serving answers computed by the earlier code.

Methods deliberately carry no version number. A content-derived identity cannot be forgotten the way a hand-maintained version integer can, and the integer would have to be remembered on exactly the occasion it is easiest to overlook: a small correction to the modelling that changes the numbers.

If two methods ever claim the same channel, dispatch raises MethodLookupError listing both, and the scenario’s methodology field is how you choose. That is the field’s only purpose, alongside reproducing an old run exactly.

What a method declares

Each publishes its contract as a MethodSpec: the channels and metrics it consumes, the input columns it requires, the add-ons and extension switches its runs need, the columns it injects, whether it restructures rows, and its params_schema. That contract is what scenario validation and the compatibility check test against.

Read it at runtime:

from euromod_linking import list_specs

for spec in list_specs():
    print(spec.name, "—", spec.summary)
    print("  consumes:", spec.channels_consumed)
    print("  needs   :", spec.dataset_requirements)

Declared contracts

Generated from the registry, so it cannot drift from the code it describes.

lma_labour_alignment

Align labour-market states (employment/unemployment) to external targets and simulate via the LMA add-on.

Shock channels:

align

Metrics:

employment, unemployment, employment_rate, participation_rate, inactivity_rate

Population cells:

Any input variable (deh=3-4, dgn=1, dag=25-34, les=5) and/or ‘region’.

Required input columns:

idhh, idperson, dwt, dag, dgn, yem

Required add-ons:

LMA / LMA_{cc}

Required extensions:

LMA_trans = True

Earliest EUROMOD release:

J2.54

Columns added to the input:

lma, yem_a, yemmy_a, lhw_a

Restructures rows:

yes — the baseline is rebuilt on the same rows so the two runs stay observation-paired

Scenario params

period (optional)

External-model period label whose targets to apply. Optional when the shock table has exactly one period.

tolerance_pct (optional)

Reporting threshold for per-cell alignment error. Default 5.0.

scale_variables

Scale numeric input variables (wages, hours, income components) per population cell — multiply, grow, add or set.

Shock channels:

scale

Metrics:

any input variable or income list

Population cells:

Any input variable (deh=3-4, dgn=1, dag=25-34) and/or ‘region’.

Required input columns:

idhh, idperson, dwt

Scenario params

period (optional)

External-model period label whose shocks to apply. Optional when the shock table has exactly one period.