· 2 min read

Waterfalls of Eligible Singles

A waterfall chart of how many people remain after each eligibility filter. The x-axis lists the steps in order: Whole US, then Didn't Meet Age Req, Sex Req, Marital Req, Education Req, Employment Req, Income Req and Race Req, ending at Met All Reqs. The y-axis is labelled People (in millions) and runs 0 to about 3.2. The first bar, in red, is the whole population at about 3.2. Each green bar after it is the number removed by that requirement, with a dashed line carrying the running total across: age takes it from 3.2 down to 1.4, sex to 0.33, marital status to 0.15, education to 0.04, and the last three requirements remove so little that their bars are invisible at this scale. The dashed line finishes flat on zero.

As a Valentine’s Day (gag) gift to one of my friends, I created a Shiny app1 that will calculate the number of people in the United States who meet specified sex, age, marital status, race/ethnicity, educational attainment, employment status, and annual income requirements.

It, obviously, could be used for anything, but the most direct application is to see how many people there are that are like you and how many there are that are like the person you want to be with. This doesn’t incorporate a myriad of things most people care about — like sexual orientation, attractiveness, chemistry, chiseled abs, or the ability to play guitar — but it’ll probably give you an approximation of the upper limit.

The app uses the 2013 American Community Survey2 via IPUMS.3 And all the code is up on my GitHub account.

While making it, I wanted to create a graph that showed how quickly the number of people were excluded with each category and I came across this awesome post by James Keirstead for making waterfall charts using R and ggplot2.

Waterfall charts (like the one at the top of this post4) are essentially just re-aligned bar plots, but imply a pattern about the data — specifically, how categorical factors add (or subtract) from some initial quantity. They are made to be read from left to right with the first bar representing the start and every other bar representing absolute change across the categorical variable. They’re a pretty handy tool to have in your visualization arsenal and somebody’s already done the hard part of coding it up.

Fun fact: some people refer to them as “Mario charts” because of the hanging “bricks”.5

Footnotes

  1. Shiny homepage

  2. The 1% sample since the 5% is not available on IPUMS yet.

  3. Steven Ruggles, J. Trent Alexander, Katie Genadek, Ronald Goeken, Matthew B. Schroeder, and Matthew Sobek. Integrated Public Use Microdata Series: Version 5.0 (Machine-readable database). Minneapolis: University of Minnesota, 2010.

  4. That’s a real plot of somebody matching my wife, +/- 5 years in age.

  5. Waterfall chart wiki