[This article was first published on Two Points Make a Line, 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.
In my last post I brought up the World Migration Matrix, an ambitious dataset constructed in 2009 by Louis Putterman and David N. Weil that attempts to trace the ancestral origins of the present-day populations of nearly every country on Earth. It’s a complete matrix, so that you can pick any pair of countries and obtain the share of one country’s ancestors that originated from the other, and vice versa. It’s a deeply fascinating dataset and I thought I’d play around with it some more. (It’s also a chance to familiarize myself further with Highcharts.)
Previously, I plotted the immigrant share of each country, i.e. the share of its current population whose ancestors were not living in that country in the year 1500 (using modern borders). A related question to ask is, what is the ancestral diversity of each country? We encountered cases like Taiwan where nearly all inhabitants have “foreign” ancestors, but since a huge portion come from China, its resulting ancestral diversity is quite low. Contrast that with, say, the United States, where both the immigrant share is high and the ancestral country sources are very diverse.
To quantify this more formally, I use 1 minus the HH index as a measure of ancestral diversity. It takes a bit of data processing so I’m hiding the code below.
The following scatter plots ancestral diversity against the immigrant share of ancestors. They go hand-in-hand up to a point, and then we encounter enormous variety. I was surprised to find that the country with the most diverse set of ancestors is Jamaica, followed very closely by the United States. The other panels below showcase the ancestral origins of Jamaica and the U.S.
Immigrant share vs diversity
Code
library(highcharter)
x <- c("Country", "Continent", "Immigrant share of ancestors", "Ancestral diversity")
y <- c("{point.country_name:s}", "{point.country_region:s}", "{point.immig:.2f}", "{point.hhi:.2f}")
tltip <- tooltip_table(x, y)
hchart(mm_immig_hhi, "scatter",
hcaes(x = immig, y = hhi, group = country_region),
color = c("#1046b1", "#a835a6", "#f0307d", "#ff6549", "#ffa600"),
stickyTracking = FALSE,
jitter = list(x = .005, y = .005)
) %>%
hc_xAxis(
title = list(text = "Immigrant share of ancestors"),
gridLineWidth = 1
) %>%
hc_yAxis(
title = list(text = "Ancestral diversity"),
gridLineWidth = 1
) %>%
hc_tooltip(
useHTML = TRUE,
pointFormat = tltip,
headerFormat = ""
)