{"id":1065,"date":"2015-03-08T21:34:26","date_gmt":"2015-03-09T02:34:26","guid":{"rendered":"http:\/\/mathewkiang.com\/?p=1065"},"modified":"2020-01-11T16:11:35","modified_gmt":"2020-01-11T21:11:35","slug":"prevalence-of-eligible-singles-in-the-united-states","status":"publish","type":"post","link":"https:\/\/mathewkiangcom.local\/2015\/03\/08\/prevalence-of-eligible-singles-in-the-united-states\/","title":{"rendered":"Waterfalls of Eligible Singles"},"content":{"rendered":"

\"\"A<\/span>s a Valentine’s Day (gag) gift\u00a0to one of my friends, I created a Shiny<\/code> app<\/a>1<\/a><\/sup> 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.<\/p>\n

<\/p>\n

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 \u2014 like sexual orientation, attractiveness, chemistry, chiseled abs, or the ability to play guitar \u2014 but it’ll\u00a0probably give you an approximation of the upper limit.<\/p>\n

The app uses the 2013 American Community Survey<\/a>2<\/a><\/sup> via IPUMS<\/a>.3<\/a><\/sup> And all the code<\/a> is\u00a0up on my GitHub account.<\/p>\n

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<\/a> for making waterfall charts using R<\/code>\u00a0and ggplot2<\/code>.<\/p>\n

Waterfall charts\u00a0(like the one at the top of this post4<\/a><\/sup>) are essentially just re-aligned bar plots, but imply a pattern about the data \u2014 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\u00a0representing the start\u00a0and every other bar representing absolute change\u00a0across the\u00a0categorical 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<\/a>.<\/p>\n

Fun fact: some people refer to them as “Mario charts” because of the hanging “bricks”.5<\/a><\/sup><\/p>\n

\n
<\/div>\n

Show 5 footnotes<\/span><\/a><\/p>\n

    \n
  1. Shiny homepage<\/a> ↩<\/a><\/span><\/li>\n
  2. The 1% sample since the 5% is not available on IPUMS yet. ↩<\/a><\/span><\/li>\n
  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. ↩<\/a><\/span><\/li>\n
  4. That’s a real plot of somebody matching my wife, +\/- 5 years in age. ↩<\/a><\/span><\/li>\n
  5. Waterfall chart wiki<\/a> ↩<\/a><\/span><\/li>\n<\/ol>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

    s a Valentine’s Day (gag) gift\u00a0to 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. Show 1 footnote Shiny homepage ↩<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[132,113],"tags":[],"_links":{"self":[{"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/posts\/1065"}],"collection":[{"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/comments?post=1065"}],"version-history":[{"count":0,"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/posts\/1065\/revisions"}],"wp:attachment":[{"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/media?parent=1065"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/categories?post=1065"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mathewkiangcom.local\/wp-json\/wp\/v2\/tags?post=1065"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}