[This article was first published on free range statistics - R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
The UN has released the 2024 Revision of World Population Prospects and I wanted to see the latest estimates of how Pacific Island Country and Territories (PICTs) populations will age in coming years.
Aging populations
After quite a bit of experimentation and iteration through different variants, I came up with this chart of the proportion of elderly people in the different PICTs:
The choice of “percentage of population that is aged 65 and over” seemed straightforward enough giving my aims to understand population aging. The harder questions were about what to map colour to. I tried an individual colour for each country – this was probably the easiest to read, and maybe what I’d use if the chart was for a more general readership. I also tried mapping colour to subregion (Melanesia, Polynesia and Micronesia), to population growth rates, and population sizes, before settling on GDP per capita in 2023 as a genuinely interesting additional variable that highlights some relationships between aging and income.
What I like about the chart I eventually chose is how it clearly shows the three clusters of countries, in terms of projected aging to 2050; and the top two (most aging) clusters of four countries each are clearly richer (in terms of GDP per capita in 2023) than the larger, bottom (least aging) cluster of poorer countries. Tiny Niue and Nauru being exceptions as countries with less predicted aging despite relatively high GDP; but Niue is a particularly difficult country to model because of its tiny size and ease of movement to New Zealand, and Nauru’s economic status is complex for all sorts of interesting historical reasons.
I did feel the sub-regional aspect was an important one too, despite not choosing it in the end for colour. So I made a faceted version of the same chart to show that, which I think works quite nicely too:
All the code for these charts is in one chunk at the bottom of the blog. It’s all straightforward stuff, importing data from two data sources and then some moderately finicky plot polishing. The power of the grammar of graphics really shone through in making it easy to iterate through different versions of these before coming to the final production charts; this isn’t so obvious in just reading the code except for when we see the simple one-liner conversion of the main chart into the faceted one.
Absolute size of population by age
I wanted a sense of the absolute magnitudes too. Proportions of populations by PICT are all very well, but how many millions of people are we talking about in different age groups? It turns out this is an important thing to visualise because of how easy it is to forget that, in numbers of people terms, the Pacific is dominated by Melanesia, and Melanesia in turn is mostly Papua New Guinea. Again after a bit of iteration and experimentation I came up with this chart to show that:
R code
Well that’s all for today very straightforward stuff but some nice charts. Big thanks to the UN for making the detailed data in the World Population Projections so nicely accessible. Here’s the code to import that data, plus GDP per capita from the Pacific Data Hub at my own work, and turn it into those charts.
Related
To leave a comment for the author, please follow the link and comment on their blog: free range statistics - R.