Assign stable cross-year person identifiers to a compensation panel
link_panel.RdEnd-to-end pipeline: prepare the panel, link records across every pair of tax
years within each organization, resolve the accepted links into person
clusters (one record per organization-year, enforced), and stamp one
deterministic EMP_ID on every record.
Usage
link_panel(
df,
cols = synthid_cols(),
weights = default_weights(),
threshold = 7,
method = c("weighted", "em"),
prob_threshold = 0.5,
verbose = FALSE
)Arguments
- df
A stacked multi-year panel: the parsed output of titleclassifier and peopleparser. Must contain at least the organization id, tax year, and full name columns named by
cols.- cols
Column mapping; see
synthid_cols().- weights
Named base match weights; see
default_weights().- threshold
Minimum match score to link two records when
method = "weighted"(default7, chosen by tuning against a labeled slice; seedev/tune_threshold.R).- method
Scoring method:
"weighted"(default) uses the hand-set Fellegi-Sunter-style additive score;"em"fits an unsupervised Fellegi-Sunter latent-class model (fit_match_model()) to the candidate comparisons and links by the learned posterior match probability, also attaching a per-person link confidence.- prob_threshold
Minimum posterior match probability to link two records when
method = "em"(default0.5).- verbose
Print progress.
Value
df with added columns: EMP_ID (stable person id), EMP_N_RECORDS,
EMP_N_YEARS, and – for method = "em" – EMP_LINK_CONF (the weakest
posterior probability among the links holding the person's cluster together;
NA for single-record persons), a ready-made confidence input for a
downstream panel model. Diagnostics are attached as the "synthid" attribute
(see synthid_report()).
Examples
if (FALSE) { # \dontrun{
panel <- readr::read_csv("PANEL-2019-2021.csv")
linked <- link_panel(panel) # hand-weighted
linked_em <- link_panel(panel, method = "em")
fs_weights(attr(linked_em, "synthid")$model) # learned weights
} # }