Monday, March 18, 2013

Fine Cuppa Joe: 96 Days and 162 Cups of Coffee


Let's get one thing straight: I love me some coffee.

Some people would disagree with me on this, but coffee is really important. Really, really important, and not just to me. Not just because companies like Starbucks and Second Cup and Caribou and Timothy's and Tim Hortons make it their business, but for another reason.

As far as I know, there are only three legal, socially acceptable drugs: alcohol, nicotine, and caffeine (and some would argue that the first two are not always socially acceptable). Coffee is really important because coffee is the most common, effective and ubiquitous source of delivery for that third drug - and one which is acceptable and ubiquitous not only socially, but also in the world of business.

I remember a long time ago there was a big blackout. I remember that after people pointed out how such a widespread outage was caused by such a small point of failure - they said things like 'This just goes to show how fragile our infrastructure is! If the terrorists want to win, all they have to do is take out one circuit breaker here or there and all of North America will collapse!'

Ha ha ha, yeah.

But I'd argue that if you really wanted all of North American society to shut down, you could really hit us where it hurts, take away something from us without which we are completely and totally hopeless - cut off our supply of coffee. Think about it! The widespread effects of everyone across all walks of life and all the industries suddenly going Cold Turkey on coffee would be far more damaging in the long run than any little black out. Run for the hills, the great Tim Hortons' riots of 2013 have erupted and apparently the Mayans only missed date of The Apocalypse by a small margin!

Or at least I think so. Or at least I think the idea is entertaining, though I probably largely got the idea from this Dilbert comic (which I find funnier and more spot-on than most).

But I digress.


Like I said, I love me some coffee (it says so in my Twitter profile), and I'm no stranger to quantified self either, so I thought it would be interesting to apply it and answer the question "Exactly how much coffee am I drinking?" amongst others.

I kept track of my coffee consumption over the period spanning November 30, 2012 to March 5, 2013. I recorded when I had coffee, where it was from, what size, and how I took it. It wasn't until almost the end of January that I realized I could also be keeping track of how long it took me to consume each cup of coffee, so I started doing that as well. Every time I do something like this I forget then remember how important it is to think about data collection before you set off on your merry way (like for example with the post on my commute).

As well as keeping track of the amount of coffee I drank in terms of cups, I converted the cups to volume by multiplying by the following approximate values:
  • Mug / Small / Short - 240 ml
  • Medium / Tall - 350 ml
  • Large / Grande - 470 ml


First and foremost, we examine where I consumed the majority of coffee from over the 3 month period. Starbucks is the clear winner and apparently I almost never go to Second Cup.

bar chart of coffee consumption by location

Second was at work (which is not really a fair comparison, as it's actually Starbucks coffee anyways). Third is at Dad's place, almost of all which is due to my being home over the holidays.

Next we look at the time of day when the coffees were consumed. I am going to use this as an illustrative example of why it is important to visualize data.

First consider a histogram for the entire time period of when all the java was imbibed:

histogram of coffee consumption by hour of day

You can see there are peaks at the hours of 10 AM and also at 2 PM. However is this telling the whole story? Let's look at the all the data plotted out by time of day:

scatterplot of coffee consumption by date and time of day

Having the data plotted out, you can see there is a distinct shift in the hours of the day when I was drinking coffee around the beginning of January. The earliest cup of the day goes from being around 9 AM to around 8, and the latest from in the evening from around 8 PM to the late afternoon (3-4 PM). Well, what happened to constitute this shift in the time of my daily java consumption? Simple - I got a new job.

You can see this shift if we overplot histograms for the hour of day before and after the change:

combined histogram of coffee consumption by hour of day

You can see that the distribution of my coffee consumption is different after I started the new gig - my initial morning coffees occur earlier (in the hours of 7-8 AM instead of 9 or later). You wouldn't have known that just from looking at the other histogram - so you can see why it's important to look at all the data before you can go jumping ahead into any analysis!

Using the ml values for the different sizes as mentioned in the introduction, we can calculate the amount consumed per day in ml for visualization of my total coffee consumption over time in volume:

cumulative coffee consumption by date
You can see that my coffee consumption is fairly consistent over time. Over the whole time period of 96 days I drank approximately 50 L of java which comes out to about 520 ml a day (or about 1.5 Talls from Starbucks). 

We can see this by adding a trend line which fits amazing well, the slope is ~0.52 and R-squared ~0.998:

cumulative coffee consumption by date (with trend line)
So the answer to the question from the beginning ("Exactly how much coffee am I drinking?") is: not as much as I thought - only about 1-2 cups a day. 

When I am drinking it? The peak times of day changed a little bit, but early in the morning and in the mid-afternoon (which I imagine is fairly typical).

How does my daily consumption look over the time period in question? Remarkably consistent.

And just in case you were wondering, out of the 162 cups of coffee I drank over the 3 months, 160 were black.


  • Majority of coffee bought from Starbucks
  • Marked shift in time of day when coffees were consumed due to change in employment
  • Regular / daily rate of consumption about 520 ml and consistent over period of examination
  • I'll take mine black, thanks