For those who aren’t familiar, Untappd is the social network for beer. With over 3 million users, Untappd is a wildly popular app that has seen its userbase grow with the increase in popularity of craft and microbreweries across the US and the world. Untappd allows its users to “check-in” every beer they drink. At minimum the check-in process involves rating your beer on a scale from 0 to 5 with .25 unit intervals. You are also given the option to tag the location you’re drinking it at as well as leave a comment and a photo.

As you might expect, this check-in process repeated week after week has the potential to create a large amount of rich data, ripe for analysis. Fortunately Untappd allows its users to download all their check-in data for $5 (or the cost per month of a pro membership). This data includes a plethora of factors about your check-ins: background information about your beers, your ratings, comments, and the time you check it in. The table below shows a snapshot of what the data you can download looks likes:

Two of my close friends, Ben and Dom, are Untappd power users. They religiously check in every single beer they drink – the good, the bad, and especially the ugly. It’s only fitting that they both subscribe to Unatppd’s pro membership. I asked them if I could have access to their data to play around with. The only stipulation they had was that I tell them the best beers they should order when they go out drinking together. Below are the results of my analysis and their customized beer buddy drinking report.

Exploratory Analysis

To get a feel for the data I combined Ben and Dom’s Untappd datasets and started running some simple summary statistics using the R statistical programming language. At the time they sent me their data, Ben and Dom had 1018 check-ins consisting of 509 unique beers and 103 styles. These beers came from 183 breweries, 142 cities, and 18 countries. That’s quite a bit of drinking diversity to break down!

I had to start somewhere so I began by creating histograms of Ben and Dom’s ratings. A histogram is a graphic display of frequency distribution. Basically we’re looking at how frequently Ben and Dom use different ratings.

Here you can clearly see Ben’s ratings are skewed towards the higher end and it appears as though he has a bias for using whole and half numbers.

Dom on the other hand has a far wider distribution, almost looking like the normal distribution (a bell curve). He is almost as likely to give high ratings (above 4) as he is to give low ratings (below 1). Dom, like Ben, also exhibits a bias towards whole and half numbers.



Combining the histograms into one chart doesn’t really show us anything new except for a scaled comparison between the two. The “M” on the chart represents the median rating – Ben’s median is a 3.5 while Dom’s is a 3.

Next I wanted to see how much their ratings varied over time. To do this I took a look at a ten check-in moving average. I hypothesized that as they checked in more beer, their ratings would become more refined and therefore, more critical (negative). Turns out I was only half right.

You can see that Ben’s ratings fluctuate a bit here and there but more or less always hover around his average. It appears as though his tastes do become more refined over time as I speculated.

Dom, in a word, is erratic. Periods of high ratings, then low then high again. Perhaps this is more indicative of recurring intervals of drinking better beers followed by intervals of drinking worse beer (weekdays vs weekends). Or maybe it’s just his personality. Dom’s general increase in ratings over time show the opposite of what I expected. Either he began drinking better beer as time went on or he has gradually become less critical when rating beers.

When to drink?

Recommending an optimal time to drink seemed to me like an essential part of Ben and Dom’s Beer Buddy Optimized Drinking Report.

To find this, I aggregated their check-ins by hour of the day. There are a few things to note that may help to understand this graph. Ben works at a startup where afternoon beers are not only allowed but encouraged. Dom works for a Fortune 500 company where the thought of mixing work and beer is simply absurd. This may help explain Ben’s steady increase in check-ins throughout the afternoon as well as Dom’s abrupt increase in check-ins starting around 5pm. The important takeaway here is that Ben and Dom both reach peak check-in frequency between the 7 and 10 pm.

Next I aggregated their check-ins by day of the week. Generally there is a steady increase in check-ins throughout the week with Tuesday being the notable exception (Tuesday happens be the night Dom and Ben’s favorite bar has a killer special each week). This shows us that Tuesday is the optimal weekday for drinking and Saturday is the optimal day for weekend drinking.

Ok this chart doesn’t contribute to the beer buddy drinking report so much but it is a fun insight I couldn’t help but share. This graph shows a running check-in tally for Ben and Dom from the time they first downloaded Untappd. Despite Ben’s seven month head start, Dom frantic check-in pace quickly surpasses Ben’s cumulative total sometime around March of 2015. Unsurprisingly they both hit their maximum check-in rate in spring of 2015, the final months of their senior year of college. In early August Dom becomes the first to reach 500 check-ins, narrowly edging out a last ditch binge surge by Ben.

What to drink?

I was interested if Ben and Dom’s tastes could be explained by alcohol by volume percentage. Linear regression is a simple statistical tool that can be used to shed insight on the causal relationship between two variables. The R Squared score (or model fit) we find at the end of a regression calculation shows us how much variation of one factor explains variation of the other factor. I initially hypothesized that both Ben and Dom gave more alcoholic beers higher ratings.

Ben’s regression between his check-in ratings and their alcohol by volume yielded a very low R squared score of .05. This means that only 5% of the variation of Ben’s ratings can be explained by alcohol by volume percentage. That’s way way lower than I expected.

Dom has an even smaller R squared score of .01 – alcohol by volume only explains 1% of the variation in Dom’s ratings! If linear regression doesn’t tell us anything, what are we going to do to determine which beers Dom and Ben should drink together? Clearly we need a new method.

The Good, the Bad, and the Ugly

Using R, I ran the data through a multidimensional simulated annealing algorithm that looked for optimally rated subsets of beer. The parameter I set the algorithm to be optimized around was the difference from the grand total average of all Dom and Ben’s check-ins. Basically I was looking for the highest above average and lowest below average subset of check-ins. After running the algorithm several times on a variety of factors (beer style, city of origin, and brewery), I selected the subsets with the most similar number of check-ins between Ben and Dom (to ensure neither one’s ratings had an outsize influence on the average). Ok I realize that may sound super complicated but fortunately the graphs below illustrate my point much better. Quick note about these graphs – the grayed out data points represent all 1018 check-ins analyzed, circles are Ben’s check-ins and triangles are Dom’s check-ins.

The algorithm found that Ben and Dom’s favorite style of beer is Oktoberfest, a special type of pale lager best known for its namesake’s festivals. Together they give it a 3.91 rating on average.

Perhaps unsurprisingly Dom and Ben’s favorite city of origin is Munich, Germany, the home of Oktoberfest (and consequently, a wide variety of Oktoberfest beers).

Finally, when set for optimal brewery, the most highly rated subset the algorithm found was beer from Great Divide Brewing Co., from Denver, Colorado. Both Dom and Ben rated beers from this brewery well above their respective averages, a 4.29 combined average rating. Great Divide does not make an Oktoberfest beer, which is unfortunate because if they did it would theoretically be maximally optimal beer choice for Dom and Ben. That aside, the two can be assured that selecting a beer from this brewery will leave them both happy.

Now to the bad beers… Ben and Dom seem to agree that American Light Lagers are pretty terrible, giving them a 1.65 rating on average. What types of beers are American Light Lagers? Well, anything from the US with a “light” in it – Coors Light, Miller Lite, Bud Light, and so on.

Finally we have the “ugly” beers. Now this wasn’t supposed to be a pro-microbrewery or an anti-“Big Alcohol” article. It just happened that both Ben and Dom strongly dislike beer from Anheuser-Busch: Bud Light, Budweiser, “Natty” Light, and Michelob were consistently given low ratings. The data does not recommend they drink beer from this “brewery” if they want to enjoy a good beer.

Conclusions

Ok now that we’re done with analysis, let’s quickly summarize what we’ve found into Ben and Dom’s Beer Buddy Optimized Drinking Report!

When to drink?

Weekdays – Tuesday

Weekend – Saturday

Time – Between 7pm and 10pm

What to drink?

Style – Oktoberfest

City of origin – Munich, Germany

Brewery – Great Divide Brewing Co.

What not to drink?

Style – American Light Lager

Brewery – Anheuser-Busch

Why drink?

This isn’t a question I could answer with the available data, but as the old saying goes, “Life’s too short to drink bad beer!”

Epilogue

This was a fun project and I created a few more visualizations than I was able to include in the main article. For instance, I made word clouds of Ben’s comments and Dom’s comments. Pretty funny and although somewhat intriguing, they weren’t necessarily relevant to my main thesis. I may post these and more in a follow up post if there’s enough interest. Ben and Dom have checked in quite a few more beers since they sent me their data for this project so there’s definitely room for further analysis!

If you want to play with this data yourself feel free to download it from my Github page here. I also plan on posting some of the R code I used for analysis on the repository when I have some free time.

And finally, if you’ve made it this far you may be interested in hearing the talk I gave at Barcamp Omaha 2015 that started this whole project!