Obervations on Income and our Wellbeing

Author

Nicholas Lay

Introduction: Do wealthier countries really live longer?

People often wonder if money can really buy happiness. While this is a great question to ask ourselves we are going to instead focus on whether or not it has a correlation to how long you may live. As we will see in the following data, it is apparent that there may be some relationship with national wealth averages and the longevity of the citizens. In this project, I use the “gapminder” dataset that is conveniently provided by R to explore how wealth and health move together and when they do not.

As you scroll, you will see:

  • A 2007 snapshot showing the famous Preston Curve (richer countries tend to have longer lives, but gains flatten out).

  • Changes over time, as global life expectancy rises and more countries escape extreme poverty.

  • Shifts in the distribution of health, not just the average.

  • Regional inequalities, and where the gains have been fastest.

  • A world map highlighting geography’s role in the story.

A 1952 snapshot: The Preston Curve

First, let’s observe 1952, the most oldest year in the Gapminder dataset.

Code
gap_1952 <- gapminder %>%
  filter(year == 1952)

ggplot(gap_1952,
       aes(x = gdpPercap,
           y = lifeExp,
           size = pop,
           color = continent)) +
  geom_point(alpha = 0.7) +
  scale_x_log10(labels = scales::dollar_format(prefix = "$")) +
  scale_size_continuous(range = c(1, 15)) +
  labs(
    title = "Health and Wealth in 1952: The Preston Curve",
    x = "GDP per Capita (log scale, 2000 US$)",
    y = "Life Expectancy at Birth (years)",
    color = "Continent",
    size = "Population"
  ) +
  guides(size = "none") +
  theme(legend.position = "bottom")

Preston Curve in 1952: GDP per capita vs life expectancy, bubble size = population.

Here we can see that there is a clear relationship between low GDP and shorter life expectancy, then as GDP increases life expectancy increases by about 30 years! Notice the scale is logarithmic and the trend flattens out as wealth increases pretty significantly.

Preston Curve in 2007

Now, take a look at 2007, our most recent data.

Code
#| label: preston-curve-2007
#| fig-cap: "Preston Curve in 2007: GDP per capita (log scale) vs life expectancy, bubble size = population."
gap_2007 <- gapminder %>% 
  filter(year == 2007)
ggplot(gap_2007,
       aes(x = gdpPercap,
           y = lifeExp,
           size = pop,
           color = continent)) +
  geom_point(alpha = 0.7) +
  scale_x_log10(labels = scales::dollar_format(prefix = "$")) +
  scale_size_continuous(range = c(1, 15)) +
  labs(
    title = "Health and Wealth in 2007: The Preston Curve",
    x = "GDP per Capita (log scale, 2000 US$)",
    y = "Life Expectancy at Birth (years)",
    size = "Population",
    color = "Continent"
  ) + guides(
    size = "none"
  ) +
  theme(
    legend.position = "bottom",
    legend.title = element_text(size = 9),
    legend.text = element_text(size = 8),
    axis.title = element_text(size = 10),
    axis.text = element_text(size = 8),
    plot.title = element_text(size = 12),
    plot.margin = margin(t = 8, r = 8, b = 18, l = 8)
  )

The trend is even more clear now and the flattening is far more obvious. The poorer countries cluster at low GDP and low life expectancy, while rich countries cluster above 75 years.
Once countries reach about $20,000 per person, extra income buys smaller health gains.

How global averages changed over time

Next, let’s see how average wealth and health changed from 1952 to 2007.

Code
global_ts <- gapminder %>%
  group_by(year) %>%
  summarise(
    mean_lifeExp = weighted.mean(lifeExp, w = pop),
    mean_gdpPercap = weighted.mean(gdpPercap, w = pop)
  )
ggplot(global_ts, aes(x = year)) +
  geom_line(aes(y = mean_lifeExp, color = "Life expectancy")) +
  geom_point(aes(y = mean_lifeExp, color = "Life expectancy")) +
  geom_line(aes(y = mean_gdpPercap / 1000, color = "GDP per capita (÷1000)")) +
  geom_point(aes(y = mean_gdpPercap / 1000, color = "GDP per capita (÷1000)")) +
  scale_color_manual(values = c("Life expectancy" = "#1b9e77",
                                "GDP per capita (÷1000)" = "#d95f02")) +
  labs(
    title = "Global Averages: Both Health and Wealth Are Rising",
    x = "Year",
    y = "Life Expectancy (years) / GDP per Capita (thousands of US$)",
    color = ""
  ) +
  theme(legend.position = "bottom")

Global average life expectancy and GDP per capita over time.

From 1952 to 2007, global life expectancy climbs from the low 50s to over 65 years , while average income (in today’s dollars) more than triples.
On average, the world is getting richer and healthier at the same time, supporting a broad link to wealth and health but there is of course more nuance to it than this because of things such as medical advancements and general lifestyle changes.

The distribution of life expectancy has shifted

Here we look at the full distribution of life expectancy over three different periods.

Code
gap_sel_years <- gapminder %>%
  filter(year %in% c(1952, 1982, 2007))
ggplot(gap_sel_years,
       aes(x = lifeExp, fill = factor(year))) +
  geom_density(alpha = 0.4) +
  labs(
    title = "From Short Lives to Longer Lives: Distributions Shift Right",
    x = "Life Expectancy at Birth (years)",
    fill = "Year"
  )

Distributions of life expectancy in 1952, 1982, and 2007.

In 1952, many countries cluster around either 40 or 65 years for life expectancy, showing that there is a clear inequality in the two groups. By 2007, the entire distribution shifts right, most countries exceed 60 years, and a growing share of the world lives beyond 70. Not only does the average for life expectancy increase but the inequality gap shrinks as well.

How regions move over time

To emphasize changes through time, we can look at ridgeline plots of life expectancy by continent.

Code
ggplot(gapminder,
       aes(x = lifeExp, y = factor(year), fill = continent)) +
  geom_density_ridges(scale = 3, alpha = 0.6, rel_min_height = 0.01,
                      color = "white", linewidth = 0.3) +
  labs(
    title = "Rising Ridges: Life Expectancy Distributions Shift Over Time",
    x = "Life Expectancy (years)",
    y = "Year",
    fill = "Continent"
  ) +
  theme(axis.text.y = element_text(size = 7))
Picking joint bandwidth of 2.24

Ridgeline plot of life expectancy over time by continent.

Each ridge shows a year’s distribution. Over time, the ridges climb toward higher life expectancy, especially in Asia and the Americas, while Africa’s ridges rise more slowly and remain lower overall. It’s worth noting that while Africa in 2007 is the lowest performer they are better off than the majority in 1952.

How has GDP changed by continent?

We have seen that the life expectancy has increased across the globe significantly but what about wealth?

Code
gdp_ts_cont <- gapminder %>%
  group_by(continent, year) %>%
  summarise(gdpPercap_pw = weighted.mean(gdpPercap, w = pop), .groups = "drop")

ggplot(gdp_ts_cont, aes(x = year, y = gdpPercap_pw, color = continent)) +
  geom_line(linewidth = 1) +
  geom_point(size = 1.8) +
  labs(
    title = "Income Growth Over Time by Continent",
    x = "Year",
    y = "GDP per Capita (2000 US$)",
    color = "Continent"
  ) +
  theme(legend.position = "bottom")

This shows us that while some regions have thrived, the global gdp averages we had shown before hide the fact that other regions are not on doing as well financially. The low earning regions here are actually doing far better health wise than you would expect based off of other correlations we had made. This shows that there is much more that affects the health of a country than just the increase in wealth.

Inequality between continents

Now let’s compare life expectancy by continent.

Code
gap_1952_2007 <- gapminder %>%
  filter(year %in% c(1952, 2007))
ggplot(gap_1952_2007,
       aes(x = continent, y = lifeExp, fill = factor(year))) +
  geom_boxplot(alpha = 0.6, outlier.alpha = 0.5) +
  labs(
    title = "Continental Gaps: Health Gains, but Not Evenly Shared",
    x = "Continent",
    y = "Life Expectancy (years)",
    fill = "Year"
  )

Life expectancy by continent in 1952 vs 2007.

Every continent improves between 1952 and 2007, but the gap between Africa and the rest of the world remains large.
Wealthy regions like Europe and the Americas move into the high 70s, while many African countries still struggle to reach the mid‑50s.

Mapping health: where are the longest lives?

Finally, we observe a map of life expectancy in 2007 across the globe.

Code
world <- ne_countries(scale = "medium", returnclass = "sf")
gap_2007_iso <- gapminder %>%
  filter(year == 2007) %>%
  mutate(iso_a3 = countrycode(country, origin = "country.name", destination = "iso3c"))
world_gap <- world %>%
  left_join(gap_2007_iso, by = "iso_a3")
ggplot(world_gap) +
  geom_sf(aes(fill = lifeExp), color = "grey30", size = 0.1) +
  scale_fill_viridis(option = "magma", na.value = "grey90", name = "Life Expectancy\n(years)") +
  labs(title = "Geography of Health in 2007") +
  theme(legend.position = "right",
        axis.text = element_blank(),
        axis.ticks = element_blank())

World map of life expectancy in 2007.

High‑income regions in North America, Western Europe, and parts of East Asia stand out with the highest life expectancy, while many countries with shorter lives are also among the poorest. This shows that where wealth is concentrated, long and healthy lives are more common.

Conclusion: Wealth and health move together — but not perfectly

Across these views, a consistent pattern emerges:

  • Within years, richer countries tend to have higher life expectancy as shown with the Preston Curve.

  • Over time, as the world gets richer, global averages and distributions of life expectancy move upward.

  • Between regions, large gaps persist, especially for Africa, reminding us that income is powerful but not the only driver of health.

In short, while there is many ways to show that there is a correlation between the health of a country and its wealth. There is also far more to it as some regions have improved their longevity significantly while their GDP has remained far below the global averages.