26

Jul

How New York Tweets About Food, Part 1

I’ve been meaning to play around with the Twitter API for quite some time now. After warming up by analyzing the relationship between followers, people followed, tweets, and account longevity, I set out to study how New York Tweets about food. So, one week ago, I set up a script that hit Twitter’s search API every minute and pulled down tweets about a variety of foods.

For no particular reason, I chose to study bacon, burgers, kale, pizza, quinoa, spinach, tacos, and tofu. Here’s how often New Yorkers tweeted about these foods across the week:

 

A number of interesting trends stand out. It’s important to keep in mind, though, that we’re only working with one week’s worth of data. And it was a strange week weather-wise, including several 100-ish degree days and a freak Wednesday afternoon hailstorm.

Caveats aside, Monday was the least popular day of the week to tweet about food; it saw about 6% fewer tweets about food than average. Wednesday was the most popular day, with 11% more tweets than average. Saturday and (strangely) Thursday are the only days with more lunch tweets than dinner tweets. On that note, here’s what an average day looks like:

Here we see in more detail that — for the foods selected, at least — breakfast is the least popular meal to tweet about. But the foods selected impact these results significantly. Even though I pulled down data for eight different foods, pizza accounted for a whopping 50% of the total food-related tweets. Bacon came in second at 10%. Quinoa and tofu, unsurprisingly, represented a paltry 2% of the total tweets collected. 

With the exception of bleary-eyed college students, most of us don’t make a breakfast out of pizza, which means that the chart above is skewed toward lunchtime, dinner, and late night dining. The data prove this; of the foods studied, pizza saw the lowest number of tweets during breakfast. The following chart shows the share of tweets about a given food that occurred during each hour of the day: 

Interestingly, burger tweets spike around lunchtime, yet don’t last as long into the night as pizza does. Tacos see relatively more late-night tweets than any other food, and are the least popular breakfast food. In general, it’s clear that I’ve chosen a sample of foods that are tilted toward lunch and dinner. For the curious, here are the patterns for each of the healthier foods. All show a similar, dinner-centric pattern:

With a handful of insights in hand, I’m going to tweak the script over the next week. I’m also going to blend in some sentiment analysis, which means we’ll know how people feel about their food in addition to when they’re tweeting about it.

A few quick notes on methodology: here’s an example of the data from the Twitter API. I used “burgers” and “tacos” because the singular comes up with too many tweets related to Taco Bell, Burger King, etc. The singular of “pizza” may have pulled down a lot of Pizza Hut-related tweets, unfortunately, but people really don’t talk about multiple pizzas too often.

Lastly, a lot of non-technical people I talk to are amazed when I explain that it only takes a few lines of code to get data from the Twitter API. For the most part, getting the data really isn’t that hard — the harder part is figuring out what to do with it. While it may read like gibberish to most folks, here are the few lines of PHP code that can process thousands of tweets:

01

Feb

Is the Super Bowl Less Exciting than the Regular Season?

Short answer to a long title: yes! The Super Bowl is, on average, less exciting than a regular season game, although that partially depends on how you define “interesting” or “exciting.”

By my count, Sunday’s Super Bowl XLVI will be the 10,413th NFL game played in the Super Bowl era, which started in 1967. Actually, it’s not by my count — it’s by Pro Football Reference’s count. The average margin of victory (MoV) across all of those games is 12.0 points. For regular season games (all 9,983 of them), average MoV is 11.9. For non-Super Bowl playoff games (385*), average MoV is 13.2. And, for Super Bowls (44), the average MoV is 14.3.

So, if you define “exciting” as a “close game”, then the Super Bowl is less exciting, right? Yes, but let’s check one more thing. Average MoV only tells you so much. What you’re really concerned with is the percentage of games that are close. Averages can get skewed by monstrous blowouts, such as the 49ers 55-10 drubbing of the Denver Broncos in 1990.

Here, by game type, is the percent of games (y axis) that are decided by a margin of victory less than or equal to the value on the x axis:

% of Games Decided by a Margin of At Least X

This chart shows us that the Super Bowl is consistently less close than the Regular Season for any margin of victory. At this point, we can safely conclude that based on margin of victory, at least,  the Super Bowl is less exciting than the regular season.

What about another metric: total points scored? Close games are nice, but an occasional shootout — even if it ends with a wide spread — can be fun, too. Here we do see a reason that Super Bowls might be more exciting: regular season games have an average point total of 41.1 points, the playoffs 42.5 points, and the Super Bowl 45.8 points. So is it safe to say that the Super Bowl shows off some more exciting offensive firepower?

Well, yes and no. Remember that part of what gets a team to the Super Bowl is its explosive offense and/or bone-crushing defense. A more interesting question, I think, is whether Super Bowl participants score more (perhaps because the game is sloppier, or played in a higher-risk fashion) or less (because they’re playing a generally outstanding defense) than they do in the regular season. Answer: eventual Super Bowl participants scored 27.2 points per game in the regular season, yet scored only 22.9 points per game in the Super Bowl itself. Guess those defenses do make a difference.

So, while the Super Bowl has more points than an average regular season game, it actually has fewer points than a regular season game featuring an eventual Super Bowl team. That’s not too surprising, of course, because certain unnamed teams (cough, St. Louis and Cleveland, cough) have bumbling offenses that score few points, and Keystone Kop defenses that let Super Bowl contenders ring up the TDs. Here are some average points per game statistics to munch on:

So why watch the Super Bowl at all? For the ads, of course. Enjoy the game… and go Steelers! Next year, that is.

* Yes, it’s strange that this is an odd number. In the 1968 season, the Raiders and Chiefs tied for the AFL Western Division, resulting in a one-game playoff. The NFL’s current tiebreak rules prevent this from ever happening again.