Saturday, February 14, 2015

Should You Go Out for a Romantic Valentine's Dinner?


No, say the experts: the restaurants will be busier and serving new menus, producing worse food and worse service which you’ll pay more for. If your date is a disaster, you’re stuck for three courses while surrounded by canoodling couples; even if it isn’t, your love may not be best celebrated at restaurants where you “feed each other every bite of the meal” and “discover how a fondue fork can give Cupid’s arrow a run for its money” [1]. I find these arguments compelling, but I’m biased: I’m spending Valentine’s alone this year, and it would warm my frozen heart to know the champagne-sipping couples I watch through rosy windows are secretly miserable.


But does the data actually support my Valentine’s fantasy? (The main perk of being a computer scientist: more statistical schadenfreude). Yelp just released 1.6 million reviews which you should all download right now, and from these I identified 1,778 Valentine's restaurant reviews. Here is what I learned:

1. People do not report worse experiences on Valentine’s Day. People tend to go out to slightly nicer restaurants on Valentine’s, probably because it’s a special occasion. But they do not give them lower reviews: there is no difference between the rating a restaurant usually gets and the rating it gets on Valentine’s. I was pretty disappointed by this, so I tried looking just at restaurants described as romantic, classy, or expensive. I also found no difference for these groups [2]. But I found some consolation in the fact that...

2. If you do go out, it is reasonably likely that you will have a bad experience. 19% of Valentine’s reviewers gave restaurants 1 or 2 stars out of 5, so ⅕ of couples I see are not having a very good time. And perhaps this is also a compelling argument for staying home with your sweetheart: imagine cooking a nice dinner, drinking some wine, and getting up to whatever else you get up to, or down to. If you really think there’s a higher than 19% chance you’d give that 1 or 2 stars, you might want to reconsider your relationship.


Going to a restaurant on Valentine’s may be riskier than going on another day: people were more likely to give restaurants 1 or 2 star reviews, although they were also more likely to give them 5 star reviews. If you’re willing to take the risk, I might suggest casting it as romantic, because danger is titillating: tell your date, “We’re risking everything by getting dinner tonight...but I want to take that journey with you.” 

There are some caveats to the ratings. Maybe if I have a mediocre Valentine’s meal, I’m more reluctant to admit it because I spent a lot of money and it makes me sad about my relationship. Or maybe there’s an effect in the opposite direction: I’m more willing to criticize a meal on Valentine’s because my expectations are higher. Also, Yelp reviewers probably don’t represent the general population: I’m no psychologist, but I’m pretty sure some of the people who write one-star reviews have anger management issues. Finally, there are some false positives in my dataset: not everyone who mentions Valentine’s in their review was going out for a romantic dinner.


What differentiates a good Valentine’s date from a bad one? Here are the phrases most associated with high and low ratings [3]:
Phrases Associated with High Ratings
Phrases Associated with Low Ratings
absolutely amazing, pretzel, crudo, flawless, worth every penny, intrusive, outstanding, so fresh, pistachio, it was delicious, gluten free, the farm, melted in my mouth
will never go back, horrible, apology, was the worst, was cold, sucks, pissed, undercooked, awful, ruined, ranch

Pretzels: the food of love. Of course, what makes a good date will vary depending on the type of restaurant. Here are some phrases that indicated good dates in different types of restaurants.


Good Dates in Expensive Restaurants
Good Dates in Inexpensive Restaurants
Good Dates in Romantic Restaurants
worth every penny, crudo, melted in my mouth, cheddar, fillet, black cod, vinaigrette, hamachi, sashimi, grits
Gluten free, the farm, pistachio, gyro, very fresh, cozy, sushi
creamy, tuna, rich, duck, oysters, attentive, local, cozy, green, las vegas, sorbet, bread pudding, scallops

3. Sandwiches aren’t sexy. To figure out which foods were most romantic, I compared the words people used to describe each restaurant on Valentine’s to the words they used to describe it on other days. Here are the foods most and least associated with Valentine’s:


Most Associated
Least Associated
set menu, cookie, champagne, lobster bisque, creamed, surf and turf, truffle, bruschetta, tenderloin, short ribs, rose, cherry, milk, chocolate covered, butternut squash, yellowtail, risotto
french toast, mexican food, happy hour, chicken, custard, bloody, taco, wings, eggs, pork belly, sake, halibut, french fries, mustard, sandwiches, broccoli, horseradish


The Valentine’s foods are mostly classics (“chocolate covered” is most frequently followed by “strawberry” but also describes bon bons and souffle). As for the non-Valentine’s foods: taking someone out for happy hour on Valentine’s might make you seem cheap, broccoli and french fries just aren’t romantic, and who wants to kiss someone who smells like mustard or horseradish? Some of the differences seem arbitrary: why is yellowtail sexier than halibut, short ribs than pork belly? Some may be due to nomenclature: perhaps on Valentine’s you rename your custard “creme brulee”.

4. There’s no statistically significant correlation between how expensive the restaurant is and the ratings people give it. So I’m definitely spending my next Valentine’s at Chipotle. Here are some phrases most associated with expensive and inexpensive Valentine’s dates [4]:
Expensive Dates
Inexpensive Dates
Paris, black truffle, bone in ribeye, caviar, creamed spinach, sommelier, beef wellington, foie gras, wine pairings, wagyu, souffle, amuse, black cod
burrito, slaw, pita, pizzas, diamond, gyro, fry, brisket, panini, meatloaf, sandwich, wrap, pad thai, chipotle, pastries, takeout, tilapia


Of course, many people may be hoping for more than black truffles from their Valentine. To determine which lovers had been sexually active after their dates, I performed a backtrace on the IPs used to submit the reviews, linked the IPs to home addresses, and looked for changes in electricity and water usage, ambient noise, and local seismological readings consistent with sexual activity. I found the following factors showed associations:


Haha naw I’m just messing with you. I’m not that creepy, and also it’s completely technically impossible. Finally, in case this wasn’t obvious, I don’t actually hate couples. Whether you’re single, married, or somewhere in between, have a very happy Valentine’s.


Notes:


[1] I will admit I harbor a certain vitriol towards fondue -- a girl once used it to try to seduce my boyfriend -- and in general towards foods with sexual overtones. If you’re hungry, eat dinner, and if you’re horny, have sex -- but public culinary foreplay has always struck me as an awkward combination.
[2] I did find a significant difference for Yelp reviewers who had earned “elite” status: they tended to give restaurants significantly higher ratings on Valentine’s Day than the restaurants received overall. I wasn’t sure why this might be, so I consulted an expert on online restaurant reviews, who suggested that elite reviewers might be better at using the review system to filter out bad restaurants or that elite reviewers were encouraged to go to restaurants with few reviews, which might be trying harder to impress customers on Valentine’s.
[3] I filtered out phrases that were redundant or uninformative.
[4] It’s possible, of course, that the cheap dates weren’t full Valentine’s dinners, just lunches that occurred on Valentine’s Day, meaning that we’re not really comparing apples to apples.




Monday, January 26, 2015

How America Responded to All 339 Lines in the State of the Union

For non-Americans: the State of the Union is an annual address in which the president outlines how the country’s doing and the agenda for the future.

Which parts of Obama’s address particularly resonated with the public? One can judge the congressional response to each line by listening to applause in the chamber, but it's harder to know what the country as a whole thought. One way to find out is to look up every single sentence in the speech on Twitter and study each response. Yes, this took a while, and yes, I should probably find other hobbies, but the results were worth it.

Each point in the graph below represents a single sentence, ordered from left to right by order in the speech; the height of the point represents how many people retweeted it.

What is that point in the upper-right corner, the quote that is shared 10 times as widely as any other line in the speech? Surely it must be some rhetorical masterstroke, a particularly inspired policy proposal? No: it's the ad-libbed moment in the speech where Obama puts down the Republicans.

We criticize our politicians for lack of civility, but how do we expect them to behave when we pay more attention to their snappy retorts than their policy proposals?

Zooming in on the graph (click here and mouse over points to see which quotes they represent) we see that many of the most widely shared lines reprise the messages of hope and unity that so resonated when Obama originally took office: "I still believe we are one people", "I still believe that together, we can do great things", and "Let's begin this new chapter -- together -- and let's start the work right now". (More substantive lines, like those about gay marriage, community college, middle-class economics, and climate change, were also shared widely).

The only problem with these pleas for unity? For the most part, only the Democrats found them compelling. Self-identified liberal tweeters outnumbered self-identified conservative tweeters more than two to one for every single one of the top 25 most retweeted lines in the speech. Among those sharing "My fellow Americans, we too are a strong, tight-knit family", I could identify 96 liberal tweeters and only 5 conservative tweeters [1]: perhaps not such a tight-knit family after all.

So what lines were shared among Republicans? Here are the lines whose retweeters skewed most conservative (among lines shared by at least five tweeters with identified political affiliation).

Quote
Republicans / Total
Already, we've made strides towards ensuring that every veteran has access to the highest quality care.
100% (14/14)
Helping hardworking families make ends meet.
99% (74/75)
In Iraq and Syria, American leadership -- including our military power -- is stopping ISIL's advance.
96% (22/23)
There are no guarantees that negotiations will succeed, and I keep all options on the table to prevent a nuclear Iran.
91% (10/11)
We need to do more than just do no harm.
86% (32/37)
That's what middle-class economics is -- the idea that this country does best when everyone gets their fair shot, everyone does their fair share, and everyone plays by the same set of rules.
84% (42/50)

Of course, just because conservatives were sharing Obama's words doesn't mean they agreed with them. For example, "Already, we've made strides towards ensuring that every veteran has access to the highest quality care" was shared by conservatives with the addendum "This one difficult to take". "We need to do more than just do no harm" was shared by conservatives who replied, "PLEASE DON'T".

Sometimes differences between the political parties emerged even in consecutive lines of the speech. For example, when Obama said "And today, America is number one in oil and gas. America is number one in wind power," 68% of people sharing the line about oil were conservative; 82% of people sharing the line about wind power were liberal.

Of course, political party isn't the only characteristic that affects how we react to a speech. Men and women [2] reacted in different ways as well.

Lines Whose Resharers Were Most Likely to Be Female
Lines Whose Resharers Were Most Likely to Be Male
That's why this Congress still needs to pass a law that makes sure a woman is paid the same as a man for doing the same work.
Instead of getting dragged into another ground war in the Middle East, we are leading a broad coalition, including Arab nations, to degrade and ultimately destroy this terrorist group.
I want our actions to tell every child, in every neighborhood: your life matters, and we are as committed to improving your life chances as we are for our own kids.
We can't slow down businesses or put our economy at risk with government shutdowns or fiscal showdowns.
It's time we stop treating childcare as a side issue, or a women's issue, and treat it like the national economic priority that it is for all of us.
We believed we could reverse the tide of outsourcing, and draw new jobs to our shores.
[Child care]'s not a nice-to-have -- it's a must-have.
Members of both parties have told me so.
Today, we're the only advanced country on Earth that doesn't guarantee paid sick leave or paid maternity leave to our workers.
We still need to make sure employees get the overtime they've earned.
That's why we defend free speech, and advocate for political prisoners, and condemn the persecution of women, or religious minorities, or people who are lesbian, gay, bisexual, or transgender.
Today, we have new tools to stop taxpayer-funded bailouts, and a new consumer watchdog to protect us from predatory lending and abusive credit card practices.
We still may not agree on a woman's right to choose, but surely we can agree it's a good thing that teen pregnancies and abortions are nearing all-time lows, and that every woman should have access to the health care she needs.
If we don't act, we'll leave our nation and our economy vulnerable.

Beyond gender and political party, people’s backgrounds guide their reactions in many subtler ways. Tweeters who reshare the speech’s quote from Pope Francis are more likely to describe themselves as Catholic; those who reshare figures on Iraq and Afghanistan are more likely to be veterans, and those who reshare figures on graduation rates and test scores are more likely to be educators.

After I completed this analysis, I could see why Obama’s speechwriter needs a stiff drink. He had to please a thousand different constituencies in a single speech, half the country wasn’t going to be happy no matter what he said, and the line that people liked best wasn’t even in his draft. I’ll stick to writing code.

Notes:
[1] Most tweeters do not identify their political affiliation in their profile, so this approach works only for a small subset of tweeters.
[2] I used the name of the tweeter to identify their gender. This does not work for all tweeters, and it does not account for people whose gender does not fit a binary description or does not match that implied by their name, but I still think it’s worth doing on balance because it gives a useful (if noisy) signal.





Thursday, January 15, 2015

The Illusion of Agreement: #CrimingWhileWhite, #AliveWhileBlack, and #LeelahAlcorn

This post discusses Leelah Alcorn, a transgender girl who committed suicide.


The Atlantic’s Quartz just published an analysis I worked on with Gilad Lotan [1] about how people discuss race on Twitter using the hashtags #CrimingWhileWhite and #AliveWhileBlack. You should read the piece (cmon -- I was writing this over Christmas) but in brief, the results are more hopeful than my earlier, depressing analysis of how people discussed Ferguson. When studying Ferguson, I found that different social groups expressed opposite views, rarely talked, and were often hostile when they did; studying #CrimingWhileWhite/#AliveWhileBlack revealed that while different social groups expressed different views, they weren’t opposite views, and information sometimes spread between groups in a constructive way.


Good signs! Unfortunately, this apparent improvement may be somewhat illusory. In the Ferguson discussion, conservatives and liberals often clashed; in the #CrimingWhileWhite and #AliveWhileBlack discussion, conservatives appear to have mostly disappeared. So it’s not that people all agree; it’s that those who disagree are silent. It’s not that the schisms that scar Twitter have healed; we’ve just zoomed in on part of the landscape.


Here’s another example of this. On December 28, Leelah Alcorn, a teenager who was born Josh Alcorn but identified as female, committed suicide and posted a note blaming her parents’ intolerance. The story spread rapidly on Twitter, where people overwhelmingly supported Leelah and blamed her parents. One of the clearest ways to see this is in the gender people used when referring to Leelah: while her mother used male pronouns, Leelah used female pronouns. Tweeters were hundreds of times more likely to use “Leelah” than “Josh”, and pronouns also show a dramatic skew. In the graph below, the green line shows the proportion of tweets that use “Josh”; the blue line shows the proportion of tweets that use “Leelah” [2].




The green spike at the beginning is due to local tweeters who were offering condolences before the suicide note had been published. Their use of “Josh” implies that Leelah’s preferred identity was not widely known (or, perhaps, ignored) among those who knew her. (One tweeter who used male pronouns defended himself by saying, “She went to my school but I didn’t know she was trans”).  


It would, of course, be wrong to conclude from this that there is overwhelming acceptance of transgender Americans. A survey of LGBT Americans found that just 3% believed there was a lot of acceptance of transgender adults. Two explanations seem more plausible: the people who would refer to Leelah with male pronouns either aren’t on Twitter, or aren’t choosing to comment in the aftermath of her suicide.


As I write in the Quartz piece, we need more than this illusory uniformity; we need fierce but productive dissent. The internet tantalizes us with its ability to create a single human overmind, but at the moment that mind’s had its corpus callosum severed. Please write to me if you have thoughts on


  1. how to get people with very different worldviews to have productive discussions of controversial issues
  2. how to search Twitter (or other areas of the internet) for signs that these discussions are occurring.


Notes:

[1] A Twitter expert. He does professionally what I only dabble in, and has studied everything from ISIS to Israel.

Wednesday, December 31, 2014

Chasing Sunlight

Sunlight is a rare gift in Oxford for three reasons: we’re very far north, it rains a lot, and even if it’s noon and sunny, the sun is often too low to make it into the narrow stone alleys [1]. So when I do see sunlight, my first instinct is that there’s something wrong with my eyes, and my second instinct is to soak up as much as possible. Others have shared this impulse, according to this very old cartoon which I swear I am not making up; note the caption at bottom:


I wanted to write about my Oxford experiences chasing sunlight and what they’ve taught me about happiness. Recently I was walking down Oxford’s main street when the sun suddenly came out from behind clouds. I found a patch of sunlight and took out the book I’d been reading: The Opposite of Loneliness, by Marina Keegan. Marina was killed in a car crash when she was 22 years old, five days after graduating from Yale, and her parents compiled her unfinished pieces into The Opposite of Loneliness. The story I opened to was about a bunch of people in a submarine that breaks, leaving them trapped at the bottom of the ocean in total darkness. They have food for six months and spend most of the story arguing about whether to commit suicide. I finished this story about all this darkness by an author who died too young and stood there in my tiny patch of sun. I’m a stats nerd so metaphors aren’t my speciality, but even I couldn’t miss the overlapping images here.
The following day, I was sitting in a cafe with my tea studying some data on the Ferguson protests, which was of course depressing, when the sun hit my cheek. Instinctively, I turned and closed my eyes to soak it in. It was so peaceful there, with the tea and the babbling British, thousands of miles from the epicenter of Ferguson’s chaos. I felt very lucky.
These experiences made me wonder: if sunlight makes me so happy, why don’t I go back to California? Two reasons. The first is the famous paper showing that, although people expect the Californian sunshine to make them happier, Californians do not in fact report higher life satisfaction. But the second reason is more interesting: even if I would experience more moment-to-moment happiness in California, that isn’t necessarily a reason to return, because I don’t live to maximize happiness. I should clarify that by “happiness” I’m referring to an emotional state -- “feeling warm and fuzzy”, maybe -- as opposed to a broader philosophical notion of fulfillment/flourishing/eudaimonia. Here are four reasons I don’t think I maximize happiness.
  1. There are other desirable emotions. At Oxford I frequently argue with people who force me to see the world in a new way, and while this feeling isn’t exactly happiness, it’s definitely something I want. I go to cocktail parties at which I’m uncomfortable, but the nervousness I feel preparing to walk into those glittering rooms is also something I want to experience. Ditto with hearing music so beautiful it makes me cry or falling down exhausted after a long hike or getting really angry over something I want to change in the world. There are also positive feelings which require longer-term effort to achieve, like self-respect or a sense of purpose.
  2. Happiness is hard to control. My happiness comes in random bursts, small pieces of glittering mica in a long stretch of cement. My happiest moment today was when I was playing piano and my kitten suddenly jumped up and started playing with the strings (also, when he jumped into my lap and we danced for a while to “Sweet Caroline”. Maybe happiness isn’t that unpredictable: the rule is, get a kitten.) In general it seems frustratingly difficult to manipulate happiness, since things you might think would do it, like winning the lottery or becoming paraplegic, often don’t produce long-term effects.
  3. I work too hard on things which have too small an effect on my happiness. I put hundreds of hours into perfecting a paper, and when it gets published (or rejected) I’m on to the next thing within 5 minutes. I have always been driven not by happiness, but desire -- to know/build/win something new. As an often romantically unsuccessful teenager, I realized that, while I was happier if my crush returned my interest, even unrequited desire could give me something exciting to think about and a reason to wake up in the morning. (Requited desire gets you into bed, but unrequited desire gets you out of it. Jane Austen said this less crudely.) Now that I’m older, I apparently still approach my science like a love-starved teenager.
But just because I am always chasing new things doesn’t mean I should be. Perhaps I push forward to avoid confronting the fact that I’m not happy where I am. My high school had a lot of hypercompetitive, overstressed kids who tried to earn perfect grades so they could go to Harvard so they could go to med school so they could ... and I imagine you’d see a similar effect among Goldman Sachs investment bankers working 90-hour weeks. For my own part, I’ve definitely been lonely on a Friday night and written some code to distract myself. But I’ve also walked out on parties, including several I hosted, because I had some code I wanted to finish; you’re judging me, whatever, but the point is that my desire to code is sincere and not merely a means of denying existential angst. (To continue the love metaphor above, the person in bed next to you, like my habit of coding at parties, may be totally crazy and annoying all your friends, but as long as you sincerely desire them it’s okay.)
Maybe, you say, you’re working really hard so you can maximize your long-term happiness: you’ll achieve some goal and be satisfied. But I’m pretty sure if you gave me a Nobel Prize tomorrow (I prefer medicine but I’ll take peace, physics and, if you really have to, econ) I would wake up the next day and write code.
  1. While I spend almost all my time coding and writing, I feel just as much (or more) happiness doing other things. A few months ago I drove down the California coastline with some friends; by day, we drank beers by the breaking waves, and at night we drank strawberry moonshine and stargazed among the redwoods. (Strawberry moonshine is better than it sounds, and I’m not an alcoholic.) Budgeting $100/day for such an epicurean lifestyle, an average tech worker could spend like eight months a year on vacation. So if I want to maximize my moment-to-moment happiness, there’s no need to go to grad school. A few years ago I did semi-seriously consider this path: I had just eaten a spectacular chocolate chip cookie and had a lovely time with someone I knew I could not seriously date, and heart attacks and heartbreak aside, the pleasures of the moment were seeming pretty good. My plan was to buy a keyboard and drive up and down California playing for tips -- “In the redwoods I'll play Rachmaninoff; by the sea, Debussy. I will eat chocolate chip cookies and foie gras, and at night i'll sleep under the stars...this is a world to be explored by tongue and fingertip, eyes closed, cerebrum sleeping.”
There are pretty obvious responses to this, like “you would get bored” or “just eating cookies and ignoring the world’s problems makes you a bit of an asshole”. The former is just true [2], so let’s talk about the latter. If I can do work that touches the lives of thousands of people, that seems more important than my moment-to-moment happiness, or maybe even the happiness of those close to me. (I have a friend who, on this basis, once vowed not to have children because it would take time from his research.) The most frequent disagreement my boyfriend and I have concerns the fact that I wake up too early; he wants me to stay in bed and talk, and I want to get up and work. But if I can make an essay a little bit better, and thousands or millions of people read it, surely that matters more than whatever conversation we were going to have.
Maybe. But this sounds self-important. If my average reader is like me, they’re reading quickly, so they may totally misinterpret what I say, ignore it even if they understand it, or quickly forget it even if they don’t ignore it. The internet in theory connects you to tons of people, but your capacity to affect each of them is tiny. You really can make a million stars tremble by shaking your fist at the sky (gravity) but we don’t fancy ourselves galactic overlords. Given our impotence at the center of this spiderweb, maybe a little humility is warranted, and some preferential attention to those whose happiness we really do have great power to affect: ourselves and those close to us.
My code always calls me, but I doubt anyone dies wishing they had spent more time coding. And if I stay in bed a little longer, I can walk with my boyfriend to get iced coffee with cream and fresh mint. The air will smell like honeysuckle and the sun will make diamonds through the leaves. In a world where a 22-year-old girl who wrote better than I do can be killed in a car crash, such pleasures do not feel like small things.

Notes:
[1] On average there are 1.7 hours of sunlight / day in December.

[2] I was initially going to argue that lots of people really do just want to drink and relax, as evidenced by their retirement plans, but the suggestions I found for “things to do when you retire” suggest that even in old age, people want more than Miami and Mai Tais.