Well, this is embarrassing. There should be an image here. Great picture, too!
Malthusian Population Growth in Matplotlib

The Class

In my final semester here at Cal, I am taking ECON C175: International Demography. It's a really interesting exploration of theories that try to explain trends in population growth and per-capita income.

The topics of population growth and per-capita income may sound abstract, but they are incredibly important. Questions about these topics bring into play huge questions about politics, economics, and the nature of humanity itself:

  • Will the human population continue to grow? Will it ever shrink? Show/Hide Answer
  • Does economics predict that we will eventually exhaust the world's resources? Show/Hide Answer
  • What is the "sweet spot" in the trade-off between income and carbon emissions? Show/Hide Answer
  • Will technology make us richer in the long run, or will progress be "eaten" by population growth? Show/Hide Answer

The Malthusian Model of Population Growth

One important lesson of the class is how a model can seem to explain the world perfectly... Until the world changes.

Malthus was a 16th-century English scholar who observed that there seemed to be an "equilibrium wage" and that the population of a nation would grow or shrink until wages were back to this relatively unprosperous level.

That made a lot of sense for his time; he observed how subsistence farming could only support so many people before the marriage rate (and therefore birth rate) went down. He also noticed how immediately after a famine (more deaths, fewer births), wages would increase in the short-term, leading to more births, fewer deaths, and more people. More people meant lower wages again.

To put it another way, more deaths meant fewer births per person (logical in the case of famine or disease), and fewer deaths meant more births per person (logical if you consider the higher wages). Births and deaths, according to Malthus, were negatively correlated.

However, with the Industrial Revolution came increased productivity, better health, and higher wages. By Mathus' logic, births should have skyrocketed! But they instead have levelled off. Whereas births and deaths were negatively correlated in the 1700s, by the 1900s the correlation reversed. A larger dataset proved Malthus wrong.

Sweden has some of the most consistent data on population, births, and deaths of any nation. Prof. Goldstein provided a nicely formatted dataset of the years since 1751. I wrote this code in matplotlib to visualize the way that population impacts the correlation between birth rate and death rate.

Side note: Its format could be described as a "scatter plot between two variables in a sliding window over the third variable". Please let me know if you know a better name for it!

Here is a video of the code in action. Try it for yourself!


It is fascinating to me to see how Malthus' theory (negative correlation between death and birth rate) holds for Sweden until populations reach about 4 million. It really makes you take other well-respected theories of demography with a grain of salt.