
Compute ratio of last salary to first pension for retired workers
compute_pension_ratio.RdFor each individual who has retired, computes the ratio of their first pension payment to their last active salary.
Usage
compute_pension_ratio(
personnel,
contracts,
salary_col,
personnel_id_col = "personnel_id",
status_col = "employment_status",
date_col = "ref_date",
pensioner_value = "pensioner",
keep_vars = NULL,
personnel_dt = NULL,
contract_dt = NULL
)Arguments
- personnel
A data.table (or tibble/data.frame) containing at minimum the columns named in
id_col,status_col, anddate_col.- contracts
A data.table (or tibble/data.frame) containing at minimum the columns named in
id_col,date_col, andsalary_col.- salary_col
A single string naming the compensation column to use, e.g.
"gross_salary_def"(default),"base_salary_lcu", etc.- personnel_id_col
A single string naming the personnel identifier column. Defaults to
"personnel_id".- status_col
A single string naming the employment status column inside
personnel_dt. Defaults to"employment_status".- date_col
A single string naming the snapshot/reference date column. Defaults to
"ref_date".- pensioner_value
A single string giving the value of
status_colthat identifies a pensioner record. Defaults to"pensioner".- keep_vars
A character vector of additional contract-level columns to attach via
govhr::add_contract_to_event(). Defaults to NULL- personnel_dt
Deprecated. Use
personnelinstead.- contract_dt
Deprecated. Use
contractsinstead.
Value
A data.table with one row per retiring individual containing
the id_col identifier, ref_date_active (last active date),
last_salary, ref_date_pension (first pension date),
first_pension, and replacement_rate.
Details
The replacement rate is a standard diagnostic in public sector pension and workforce analysis, and it matters here for a few distinct reasons:
Fiscal sustainability: Aggregated across occupation or paygrade, replacement rates feed directly into pension liability projections.
Retirement incentive / take-up behavior: Low replacement rates help explain deferred retirement, relevant to calibrating
ANNUAL_TAKE_UPrather than assuming 100\ eligibility.Equity diagnostics: Comparing rates across paygrade, occupation, or establishment can surface structural inequities in how the pension formula interacts with career trajectories.
Policy reform simulation: Because the function is column-name agnostic, it can be re-run under counterfactual salary or pension formulas or against differently structured client datasets without code changes.