Background
run_forecast() already returns WPP-2024 reference columns (un_*_median / un_*_95low / un_*_95high) for the time-series outputs:
population_by_time
tfr_by_time
e0_by_time
mig_by_time
This lets the demographydash app overlay the UN reference on those charts. The remaining by-age outputs do not carry UN reference columns:
population_by_age_and_sex — has only year, age, popM, popF
population_by_broad_age_group — has only year, age, pop, pop_percent
annual_growth_rate — has only year, age, growth_rate
So the demographydash Compare-Simulations views for population pyramid, population by broad age groups, and growth rate by age cannot draw the UN reference. This was raised by Mengjia Liang / Patrick Gerland in the April 8 OPPP review (item 5 of their feedback list) and is the only deferred item from that round.
Desired changes (mirroring the existing un_* naming in population_by_time)
population_by_age_and_sex — add un_popM_median, un_popF_median (and ideally un_popM_95low / un_popM_95high / un_popF_95low / un_popF_95high).
population_by_broad_age_group — add un_pop_median (and un_pop_95low / un_pop_95high).
annual_growth_rate — add un_growth_rate_median (and un_growth_rate_95low / un_growth_rate_95high).
The canonical pattern to copy is get_pop_by_time() in R/forecast.R, which already merges WPP via get_wpp_pop_by_age_multiple_years() for the median and get_wpp_indicator_multiple_years("popprojAgeGrp1dt", package = "wpp2024extra") for the prediction intervals.
Draft PR (median-only)
I'm opening a draft PR (#) that wires up the median columns for all three outputs by reusing the existing helpers get_wpp_pop_by_age_multiple_years(), get_pop_by_broad_age(), and get_annual_growth_rate(). The 95% PI columns are marked TODO(hana) — they depend on bayesPop's quantiles{M,F}age object (already touched in extract_pop_by_age_sex), and figuring out the right quantile keys / open-age handling is your call. Happy to extend the PR once you point me at the right shape.
cc @hanase
Background
run_forecast()already returns WPP-2024 reference columns (un_*_median/un_*_95low/un_*_95high) for the time-series outputs:population_by_timetfr_by_timee0_by_timemig_by_timeThis lets the demographydash app overlay the UN reference on those charts. The remaining by-age outputs do not carry UN reference columns:
population_by_age_and_sex— has onlyyear, age, popM, popFpopulation_by_broad_age_group— has onlyyear, age, pop, pop_percentannual_growth_rate— has onlyyear, age, growth_rateSo the demographydash Compare-Simulations views for population pyramid, population by broad age groups, and growth rate by age cannot draw the UN reference. This was raised by Mengjia Liang / Patrick Gerland in the April 8 OPPP review (item 5 of their feedback list) and is the only deferred item from that round.
Desired changes (mirroring the existing
un_*naming inpopulation_by_time)population_by_age_and_sex— addun_popM_median,un_popF_median(and ideallyun_popM_95low / un_popM_95high / un_popF_95low / un_popF_95high).population_by_broad_age_group— addun_pop_median(andun_pop_95low / un_pop_95high).annual_growth_rate— addun_growth_rate_median(andun_growth_rate_95low / un_growth_rate_95high).The canonical pattern to copy is
get_pop_by_time()inR/forecast.R, which already merges WPP viaget_wpp_pop_by_age_multiple_years()for the median andget_wpp_indicator_multiple_years("popprojAgeGrp1dt", package = "wpp2024extra")for the prediction intervals.Draft PR (median-only)
I'm opening a draft PR (#) that wires up the median columns for all three outputs by reusing the existing helpers
get_wpp_pop_by_age_multiple_years(),get_pop_by_broad_age(), andget_annual_growth_rate(). The 95% PI columns are markedTODO(hana)— they depend on bayesPop'squantiles{M,F}ageobject (already touched inextract_pop_by_age_sex), and figuring out the right quantile keys / open-age handling is your call. Happy to extend the PR once you point me at the right shape.cc @hanase