Retiree life expectancy¶
For each calendar year of retirement, how many further years could someone expect to live, conditional on having reached that year's retirement age?
Use Italy's observed single-age death probabilities from notebook 30, their projections from notebook 63, and the historical/current ages and all nine future retirement-age scenarios from notebook 84. This notebook runs entirely offline from the derived CSVs; it makes no ISTAT requests.
import sys
from pathlib import Path
import hashlib
import json
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import plotly.io as pio
from plotly.colors import qualitative
from IPython.display import Markdown, display
ROOT = Path("..").resolve()
sys.path.insert(0, str(ROOT / "scripts"))
from retiree_life_expectancy import period_life_expectancy, retirement_expectancies
pio.renderers.default = "plotly_mimetype+notebook"
pd.options.display.max_colwidth = 45
Inputs and coverage¶
| Input | Interpretation |
|---|---|
deathprob_by_age_year.csv (30) |
ISTAT 26_295_DF_DCIS_MORTALITA1_2, annual Italy / SEX=9 (both sexes) / PROBDEATH / all single ages, 1974–2025. Source values per thousand were already divided by 1,000 in notebook 30. Last retrieved 11 November 2026; no retrieval here. |
deathprob_by_age_year_proj.csv (63) |
2026–2100 mortality probabilities from the same observed age series. |
retirement_age_by_year.csv (84) |
Calendar-year effective retirement ages, current assumptions, and nine future demographic retirement-age paths, exported directly by notebook 84. |
The historical retirement series is the digitized OECD series already used in notebook 84 (1974–2023), using the unweighted mean of male and female ages. The digitized source link is retained there. This is a representative age applied to the both-sex life table, not a sex-weighted estimate for actual pension entrants.
2024–2026 retirement age is assumed to be 64, following notebook 84; it is not an observation. Mortality is observed through 2025 and projected from 2026. The nine retirement-age paths start after the population baseline of January 2026, hence in 2027.
observed = pd.read_csv(ROOT / "data/deathprob_by_age_year.csv", index_col=0).rename(columns=int)
projected = pd.read_csv(ROOT / "data/deathprob_by_age_year_proj.csv", index_col=0).rename(columns=int)
retirement = pd.read_csv(ROOT / "data/retirement_age_by_year.csv")
retirement = retirement.loc[retirement.year >= observed.columns.min()].copy()
retirement_reference = json.loads((ROOT / "data/retirement_summary.json").read_text())
scenarios = list(retirement_reference["scenarios"])
last_mortality_year = int(observed.columns.max())
last_population_year = int(retirement_reference["reference_years"][1])
end_year = int(projected.columns.max())
assert len(scenarios) == 9
assert list(observed.index) == list(range(120))
assert list(projected.index) == list(range(120))
assert list(observed.columns) == list(range(observed.columns.min(), last_mortality_year + 1))
assert list(projected.columns) == list(range(last_mortality_year + 1, end_year + 1))
assert not retirement.duplicated(["year", "scenario"]).any()
for scenario in scenarios:
assert retirement.loc[retirement.scenario == scenario, "year"].tolist() == list(range(last_population_year + 1, end_year + 1))
current_ages = retirement.loc[retirement.scenario == "Historical / current"]
assert current_ages.year.tolist() == list(range(observed.columns.min(), last_population_year + 1))
assert set(retirement.scenario) == {"Historical / current", *scenarios}
print(f"Observed mortality: {observed.columns.min()}–{last_mortality_year}; projected: {last_mortality_year + 1}–{end_year}")
print(f"Observed retirement ages through {current_ages.loc[current_ages.retirement_age_source == 'observed effective age', 'year'].max()}; {len(scenarios)} future scenarios")
# Read the matching local source manifest when available; fresh checkouts can use the CSVs alone.
source_manifests = [json.loads(p.read_text()) for p in (ROOT / "data/sources").glob("26_295_DF_DCIS_MORTALITA1_2_*.json")]
mortality_retrieved_at = max(
(m["retrieved_at"] for m in source_manifests
if m.get("key") == {"FREQ": "A", "REF_AREA": "IT", "DATA_TYPE": "PROBDEATH", "AGE": [], "SEX": "9"}),
default=None,
)
Conditional life-table calculation¶
Let $q_{x,y}$ be the probability of dying before age $x+1$ after reaching exact age $x$ in year $y$. For each year, hold its age-specific probabilities fixed over the remaining lifetime. This gives period remaining life expectancy, using the standard life-table definition.
With deaths uniform within each one-year age interval, the backwards recurrence is
$$e_{x,y}=1-\frac{q_{x,y}}{2}+(1-q_{x,y})e_{x+1,y}.$$
It is equivalent to integrating the survival curve conditional on reaching retirement age. For a fractional retirement age $a=x+t$, $0\leq t<1$, the same assumption gives
$$e_{x+t,y}=\frac{e_{x,y}-t+q_{x,y}t^2/2}{1-tq_{x,y}}.$$
Thus neither rounding retirement ages nor subtracting retirement age from life expectancy at birth is necessary.
Use the complete age series through 119. Beyond that last age, repeat $q_{119,y}$, giving the analytic open tail $e_{119,y}=1/q_{119,y}-1/2$. The table below checks sensitivity to forcing death within that final interval instead. These ages are extrapolated in the source, as notebook 30 explains. We use their detailed probabilities rather than notebook 70's coarse 40% mortality assumption for its aggregate 100+ population bin.
This is a population life-table estimate conditional on age, not an estimate of mortality selection among retirees. A cohort expectancy would follow changing mortality as each person ages and would require assumptions beyond 2100 for late retirees; that is a different measure.
# Age 50 is safely below every retirement age here; no infant mortality approximation is needed.
observed_adult = observed.loc[50:]
projected_adult = projected.loc[50:]
results = retirement_expectancies(retirement, observed_adult, projected_adult)
mortality = pd.concat([observed_adult, projected_adult], axis=1)
life_tables = period_life_expectancy(mortality)
# A fixed age isolates the mortality improvement from changes in retirement ages.
fixed_age = 65
fixed_age_expectancy = life_tables.loc[fixed_age].rename("remaining_life_expectancy").rename_axis("year").reset_index()
fixed_age_expectancy["mortality_source"] = np.where(fixed_age_expectancy.year <= last_mortality_year, "observed", "projected")
closed_observed, closed_projected = observed_adult.copy(), projected_adult.copy()
closed_observed.loc[119] = 1
closed_projected.loc[119] = 1
closed_results = retirement_expectancies(retirement, closed_observed, closed_projected)
tail_difference = float((results.remaining_life_expectancy - closed_results.remaining_life_expectancy).abs().max())
assert np.isfinite(results[["retirement_age", "remaining_life_expectancy", "expected_age_at_death"]]).all().all()
assert (results.remaining_life_expectancy > 0).all()
print(f"Maximum effect of the age-119 tail choice: {tail_difference:.3g} years")
print(f"At fixed age {fixed_age}: {life_tables.at[fixed_age, last_mortality_year]:.2f} further years in {last_mortality_year}, {life_tables.at[fixed_age, end_year]:.2f} in {end_year}")
Remaining life at each year's retirement age¶
The horizontal axis is year of retirement, not year of birth. Black uses observed effective retirement ages; the dotted segment uses notebook 84's age-64 assumption. Future scenario lines use each scenario's own retirement age. Hover shows the age, remaining years, and source status.
Mortality projections reuse notebook 63 without a separate life-expectancy trend fit: the mean of an age-specific log-linear mortality trend and the latest 12 available non-COVID annual probabilities. Its trend fit excludes 2003 and 2020–2021 (and 1988–1999 at ages 1–40). There is one mortality path shared by all nine fertility/migration scenarios. The projected mortality need not join the last observed year smoothly, and the integer retirement-age search can produce one-year steps.
historical = results.loc[results.scenario == "Historical / current"].sort_values("year")
future = results.loc[results.scenario.isin(scenarios)]
observed_ages = historical.loc[historical.retirement_age_source == "observed effective age"]
assumed_ages = pd.concat([observed_ages.tail(1), historical.loc[historical.retirement_age_source == "assumed age"]])
anchor = historical.tail(1)
colors = dict(zip(scenarios, qualitative.Plotly))
fig = go.Figure()
def add_line(frame, label, color, dash="solid"):
fig.add_trace(go.Scatter(
x=frame.year, y=frame.remaining_life_expectancy, mode="lines", name=label,
line=dict(color=color, dash=dash, width=2),
customdata=frame[["retirement_age", "mortality_source", "retirement_age_source"]].to_numpy(),
hovertemplate="Retirement year %{x}<br>Age at retirement: %{customdata[0]:.2f}<br>Expected further years: %{y:.2f}<br>Mortality: %{customdata[1]}<br>Retirement age: %{customdata[2]}<extra>%{fullData.name}</extra>",
))
add_line(observed_ages, "Observed effective retirement age", "black")
add_line(assumed_ages, "Assumed retirement age (2024–2026)", "#777777", "dot")
for scenario in scenarios:
frame = pd.concat([anchor, future.loc[future.scenario == scenario]]).sort_values("year")
add_line(frame, scenario, colors[scenario])
fig.update_layout(
template="plotly", showlegend=False,
xaxis_title="Calendar year of retirement", yaxis_title="Expected further years of life",
xaxis=dict(range=[int(observed.columns.min()), end_year]),
margin=dict(l=55, r=15, t=20, b=45), width=780, height=320,
)
fig.write_html(ROOT / "images_output/retiree_life_expectancy.html")
fig.show()
# A static companion also shows the mortality-only comparison at fixed age 65.
fig_static, axes = plt.subplots(2, 1, figsize=(11.5, 8), sharex=True, layout="constrained", gridspec_kw={"height_ratios": [2, 1]})
ax = axes[0]
for scenario in scenarios:
frame = pd.concat([anchor, future.loc[future.scenario == scenario]]).sort_values("year")
ax.plot(frame.year, frame.remaining_life_expectancy, color=colors[scenario], lw=1.8, label=scenario)
ax.plot(observed_ages.year, observed_ages.remaining_life_expectancy, color="black", lw=2, label="Observed effective retirement age")
ax.plot(assumed_ages.year, assumed_ages.remaining_life_expectancy, color="#777777", ls=":", lw=2, label="Assumed age 64 (2024–2026)")
ax.set_title("Expected remaining life at each year's retirement age", loc="left")
ax.set_ylabel("Further years of life")
handles, labels = ax.get_legend_handles_labels()
fig_static.legend(handles[-2:] + handles[:-2], labels[-2:] + labels[:-2], loc="outside lower center", ncols=3, fontsize=8.5, frameon=False)
ax = axes[1]
observed_fixed = fixed_age_expectancy.loc[fixed_age_expectancy.year <= last_mortality_year]
projected_fixed = fixed_age_expectancy.loc[fixed_age_expectancy.year >= last_mortality_year]
ax.plot(observed_fixed.year, observed_fixed.remaining_life_expectancy, color="black", lw=2)
ax.plot(projected_fixed.year, projected_fixed.remaining_life_expectancy, color="#3274a1", ls="--", lw=2)
ax.set_title(f"Mortality comparison: retirement held at age {fixed_age}", loc="left")
ax.set_ylabel("Further years of life")
ax.set_xlabel("Calendar year of retirement")
for ax in axes:
ax.axvspan(last_mortality_year + 0.5, end_year, color="#e8edf5", alpha=0.6)
ax.set_xlim(int(observed.columns.min()), end_year)
ax.grid(axis="y", alpha=0.25)
fig_static.savefig(ROOT / "images_output/retiree_life_expectancy.png", dpi=180, bbox_inches="tight")
plt.show()
Results and reproducible exports¶
The values below summarize actual retirement ages through 2023, the present assumption, and all nine scenarios in 2050 and 2100. All years are saved in a tidy CSV. The JSON records method assumptions, input hashes, source coverage, fixed-age comparisons, and the end-of-century scenario range.
selected = results.loc[
((results.scenario == "Historical / current") & results.year.isin([1974, 2023, last_mortality_year, last_population_year]))
| (results.scenario.isin(scenarios) & results.year.isin([2050, end_year]))
]
display(selected[["year", "scenario", "retirement_age", "remaining_life_expectancy", "mortality_source", "retirement_age_source"]].round(2).reset_index(drop=True))
results.to_csv(ROOT / "data/retiree_life_expectancy_by_year.csv", index=False)
fixed_age_expectancy.to_csv(ROOT / "data/retiree_fixed_age_life_expectancy.csv", index=False)
last = future.loc[future.year == end_year]
input_names = ["deathprob_by_age_year.csv", "deathprob_by_age_year_proj.csv", "retirement_age_by_year.csv", "retirement_summary.json"]
summary = {
"measure": "period remaining life expectancy conditional on reaching retirement age",
"units": "years",
"mortality_source": {"dataset": "26_295_DF_DCIS_MORTALITA1_2", "filters": {"FREQ": "A", "REF_AREA": "IT", "DATA_TYPE": "PROBDEATH", "SEX": "9", "AGE": "all single ages"}, "retrieved_at": mortality_retrieved_at, "probabilities_already_divided_by": 1000},
"observed_mortality_years": [int(observed.columns.min()), last_mortality_year],
"projected_mortality_years": [last_mortality_year + 1, end_year],
"observed_retirement_age_years": [int(observed_ages.year.min()), int(observed_ages.year.max())],
"assumed_retirement_age_years": historical.loc[historical.retirement_age_source == "assumed age", "year"].tolist(),
"assumed_retirement_age": 64,
"retirement_projection_years": [last_population_year + 1, end_year],
"retirement_reference_ratio": retirement_reference["reference_ratio"],
"mortality_projection": "Reuse notebook 63: mean of age-specific exponential trend and rolling 12 non-COVID observation-year average; common to all nine scenarios",
"within_age_interval": "uniform distribution of deaths; conditional fractional-age formula",
"oldest_age_tail": "repeat age-119 annual probability above age 119; analytic geometric tail",
"max_tail_sensitivity_years": tail_difference,
"fixed_retirement_age": fixed_age,
"fixed_age_remaining_life": {str(y): float(life_tables.at[fixed_age, y]) for y in [int(observed.columns.min()), last_mortality_year, last_mortality_year + 1, end_year]},
"scenario_count": len(scenarios),
"scenario_results_at_end_year": {
row.scenario: {"retirement_age": float(row.retirement_age), "remaining_life_expectancy": float(row.remaining_life_expectancy)}
for row in last.itertuples()
},
"input_sha256": {name: hashlib.sha256((ROOT / "data" / name).read_bytes()).hexdigest() for name in input_names},
}
(ROOT / "data/retiree_life_expectancy_summary.json").write_text(json.dumps(summary, indent=2, ensure_ascii=False) + "\n")
display(Markdown(
f"In **{end_year}**, the nine demographic scenarios imply retirement ages of **{last.retirement_age.min():.0f}–{last.retirement_age.max():.0f}** and **{last.remaining_life_expectancy.min():.1f}–{last.remaining_life_expectancy.max():.1f} further years** of period life expectancy. "
f"At a fixed age of {fixed_age}, expected remaining life changes from **{life_tables.at[fixed_age, last_mortality_year]:.1f}** years in {last_mortality_year} to **{life_tables.at[fixed_age, end_year]:.1f}** in {end_year}."
))
A higher retirement age can reduce expected years in retirement even while mortality improves at a fixed age. Scenario overlaps reflect identical retirement ages under the common mortality path. These are demographic comparisons: notebook 84's ages are population-ratio proxies, and the analysis does not model statutory eligibility, healthy life expectancy, employment, wages or pension finances. The source and model assumptions remain visible in the exported CSVs and summary.