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.

[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.

Friday, December 26, 2014

Response To The Comments On The Sexual Assault Model

Content warning: this post discusses sexual assault in some detail.  

A few weeks ago I created a statistical model which implied that someone who has been accused of sexual assault by multiple people is much less likely to be innocent than someone who has been accused of assault once. This ended up on the front page of Hacker News, which Wikipedia describes as a “social news website that caters to programmers and entrepreneurs”, and got as many views in two hours as this blog usually gets in two months. (Granted, that’s not really that much traffic, but we math nerds take what social interaction we can get.)

While many of the comments were critical, almost all of them were civil, thoughtful, and free from the kind of trolling that women worry about when discussing controversial gender issues. All this was tremendously welcome and we need more of it on the internet, so I thought I’d take the time to respond to the most interesting criticisms.

To briefly recap (skip to the next paragraph if you remember all this) the model computes the probability that someone who has been accused of sexual assault by k people has never actually committed assault. The model assumes that there are serial predators, who have a high probability of assaulting people, and non-serial predators, who have a low probability of assaulting people. If someone has been assaulted, they accuse the other person of assault with probability pag; if they have not, they accuse with lower probability pai. You can play with the model here (move the sliders).

As I note in the post, the model is a simplification of the real world, as all models are. That said, it is possible to build a model which is too simple. For example, after Thomas Duncan’s nurse became infected with Ebola, it would’ve been irresponsible to say, “Assuming the current rate of weekly doubling of the Ebola epidemic in the United States continues, we expect every US citizen to be infected 28 weeks from now.” So I will discuss three assumptions the model makes and you can judge their validity and usefulness for yourself. Overall my view is that, while the model simplifies out of necessity, its basic conclusions probably hold even under more complicated assumptions. But I also see why there is room for disagreement because of the uncertainty about basic facts about assault, and trying to build a model has definitely reinforced my belief that we need better data. There also are clear tradeoffs between reducing the number of assaults and not punishing innocent people; your background and life experiences differ from mine, so you may worry more about victims of assault and less about the wrongfully accused, or vice versa.

  1. Objection 1: the model assumes that each accuser comes forward independently, but in fact each accuser may be influenced by previous accusers. This was the main concern people on Hacker News raised [1], and I think it is definitely important in high-profile cases like Bill Cosby’s, where accusers may well know about and be influenced by previous accusations. But I do not think cases like Cosby’s are the most representative or important to focus on, because the vast majority of accused and actual rapists are not famous. In these more representative cases, I do not think we should worry too much about accusers influencing each other for several reasons.

  1. In my post I discuss a tool which allows accusers to file accusations with a third party who will keep the accusations confidential unless multiple accusations are levied at the same person. If this tool were used, it seems quite likely that accusations would be essentially independent because they would be kept secret. (I guess it is possible that accusers might collude and all submit accusations together, but this John Tucker Must Die scenario stretches the bounds of plausibility.)
  2. Even if this tool is not used, accusers have to know about previous accusations to be influenced. This is by no means certain: how many people do you know who are currently being accused of assault? How often do you compare notes with someone who has had a sexual encounter with the same person?
  3. Even if accusers are aware of previous accusations, either i) they were actually assaulted, in which case it’s a good thing if they’re more likely to come forward or ii) they were not actually assaulted, in which case it’s a little unclear why they’re now more likely to come forward. The thought process might go something like, “Well, I’m not sure exactly what happened...I thought it was consensual at the time, but if they attacked other people, I guess they attacked me too.” This seems a bit unlikely to me, but feel free to suggest more plausible reasoning.
  4. Even if you disagree with all of the above speculations about probabilities, I built you another model that allows you to adjust them (you might have to zoom out to see all the sliders) and account for accusers who influence each other. I describe the mathematical details here [2]. Even if accusers can influence each other quite strongly, this model yields the same conclusion as before: someone accused of sexual assault multiple times is much less likely to be innocent. For example, I still see the same effect if I make an accuser ten times more likely to accuse an innocent person of assault if they learn they’ve been previously accused.

2. Objection 2: the model assumes that everyone is equally likely to be accused of assault. Several people pointed out that there are factors that influence how likely a person is to be accused of assault besides whether they actually assaulted someone. To take one example, someone who has sex with their partner of ten years may be less likely to be accused than someone who has sex with a person they met for the first time at a frat party, even if both encounters are consensual. More generally, we can imagine two groups of people, A and B, who have different sorts of sexual encounters, and thus different probabilities of being innocent:

I think this only alters our basic conclusion, though, if we think of a group who is a) reasonably large and b) a lot more likely to be accused of assault even when they are innocent. (Merely identifying group differences is not enough: you would have to identify a group for whom we can set the parameters of the original model such that the innocence curve no longer plunges sharply.) None of the people I spoke to about this advanced plausible candidates for such a group, but let me know if you have thoughts.
3. Objection 3: the model computes the probability that the accused is guilty of at least one assault, but that is not the probability we are interested in. In no court would a judge say, “Well, I don’t know which of these six alleged assaults the accused is guilty of, but there’s a very high probability he’s guilty of at least one, so I’m throwing him in jail.”

Still, when we’re not throwing someone in jail, we often do care about the probability the model computes. Maybe I’m in charge of student housing, someone’s been accused of assault by two of their dorm mates, and I’m trying to decide whether to move them to another house (or out of housing altogether). We frequently apply statistical reasoning that isn’t allowed in a courtroom.

Also, it turns out we can use a similar model to compute the probability that someone is guilty in a particular case (rather than in any case) given that they have k previous accusations of sexual assault, and it produces similar curves [3].

If you’ve made it this far, especially if you disagreed with me at the outset, thanks so much for reading, because I wrote this mainly for you. I imagine we still have disagreements and would welcome your comments below or via email.

[1] Some made comparisons to witchcraft trials, where a “mob mentality” takes hold and many people accuse one person of witchcraft. I will say, first, that I think witch trials are so different as to make this comparison pretty useless. A large number of people are truly assaulted; no one is a true victim of witchcraft. I do not believe there are mobs of potential assault accusers who, having all had sex with the same person, are suddenly all possessed by groupthink and decide that their sexual encounters constituted assault.

[2] The model assumes that if someone’s been previously accused of assault, a potential accuser knows about it with probability pk; if they know about the previous accusations, they accuse with probability pag1  if the person assaulted them and pai1  if the person did not; if the potential accuser does not know about the previous accusations, they accuse with probability pag0  if the person assaulted them and pai0  if the person did not. As pk  goes to zero -- no accuser knows about the others -- we recover the old model, where every accuser acts independently. On the other hand, if we increase pk  and pai1  to 1 -- accusers are certain to know about the first accusation, and certain to accuse if they know about it -- every accusation after the first becomes uninformative, as we would expect. We see the same effect as in the old model even for quite high settings of pk  and pai1 -- which can’t be all that high by simple virtue of the fact that very few people are accused of assault -- someone who is accused multiple times is much less likely to be innocent.

[3] The lawyers I discussed this with are still uncomfortable with this kind of reasoning, where past accusations can influence present guilt. My general sense is that the legal system disallows a lot of reasoning that statisticians deem kosher -- which is probably, given the weight we place on not convicting the innocent, a good thing.

Thursday, November 27, 2014

Ferguson FAQ

Recently I published an analysis of the Ferguson conflict that showed, using Twitter data, that there was a “red group” and a “blue group” who rarely talked to each other, thought very different things, came from very different backgrounds, and often were uncivil even when they did talk. Thanks to everyone who wrote to me about the analysis! Here are answers to the most common questions I’ve received.

What data did you use?

215,000 tweets containing the Ferguson hashtag collected between November 17th and 19th (prior to the announcement of the verdict).

What tools did you use to collect the data?

Python -- specifically, the tweepy library and a program I wrote which you can find here (described at more length here).

What tools did you use to analyze the data and make the visualization?

Python for analysis; Gephi for visualization. See Gilad Lotan’s excellent tutorial on how to use Gephi to analyze Twitter data.

How did you divide Tweeters into red and blue groups?

I used Gephi's community detection algorithm (on the adjacency matrix for the most frequent tweeters, where Mij was 1 if tweeter i had mentioned tweeter j in a tweet), sometimes known as the Louvain method. Essentially, this divides Tweeters into groups that mention each other frequently.

Regarding whether this grouping is valid: as I note in the piece, I am mindful of the fact that there are many ways to group data, and I think this is worth exploring further. One problem we always face is how many groups there are (see here and here). You can always sort of make it look like people hate each other by clustering the data into groups even if there isn’t necessarily any separation between the groups -- this is something to be wary of when looking at analyses like this one.

But I think several pieces of evidence (in addition to Gephi's striking visual) point to the validity of the red / blue division. The fact that the two groups are associated with the tweeters’ self-descriptions (like race and political affiliation) is revealing; the fact that the two groups are associated with tweeting different things is also revealing (and by no means something I expected to see -- for example, if you divide Twitter datasets by gender, you will frequently find that men and women tweet essentially similar things). This evidence is powerful because it is external -- it was not used to come up with the grouping, but it supports it.

In general, we often bring in such external evidence to argue that a grouping is valid. For example, in a biological analysis we might cluster genes into groups that show similar expression patterns (group A highly expressed in the liver and not in the lungs; group B highly expressed in the lungs and not in the liver). We would be more sure that the groups we had found were “real” if there was external evidence like a transcription factor that was known to turn on all the genes in group A, or a biological function that was common to all the genes in group A.

You said the blue cluster is much larger than the red cluster. What happens if you break down the blue cluster further?

I don’t know! Someone should figure this out.

Can I see your data or code?

Yes. I cannot make the data publicly available because of Twitter’s terms of service, but if you are a researcher with a project, shoot me an email. In addition to the two days of data used in this analysis, I also have several million tweets both from several months ago, when Ferguson initially made the news, and from after the verdict was announced.

As always, if you work at Twitter and have any objection to any of this, please email me -- I am acting in good faith and more than happy to comply with your requests.

Saturday, November 1, 2014

Why I'm Not Flirting with Lesbians In Central Park

I have flown across the ocean to become a Very Serious Oxford Student who can read two books at once, tassel swinging:

I have been told that Oxford will actually expel me for wearing that hat. Today is my one-month anniversary of arriving in England and I’ve decided that I should write a piece or two about what I’ve learned here, in part to confirm to my family that I’m still alive. If you just want statistics, please skip this post and I promise the next one will have lots and lots of p-values.

I have never before gone weeks half-wondering if I’m dreaming. At first I thought it was just jetlag or social exhaustion, but I’ve come to realize that it’s something longer-term: I never fully understood that filling out those scholarship forms meant I would, in fact, fly across a real ocean and attend a real university. So when I sit at formal hall eating smoked duck and drinking white wine in a building about 40 times older than I am, part of me believes that I am, in this well-named “city of dreaming spires”, still asleep. That, of course, is a good dream.
Lesson 1: we forget how many ways there are to live a life. Keeping sane, I think, requires becoming willfully blind to possible lives. Eg, at the moment I am a long-haired computer science researcher in a committed straight relationship; but if I wanted to, by tomorrow I could be a spiky-haired harmonica-player flirting with lesbians in Central Park. In theory. But, of course, I don’t really consider that possibility, because it’s terrifying and paralyzing to constantly consider dumping your boyfriend, switching careers, and crossing an ocean; I get pretty overloaded just deciding what to eat for lunch. And because the grass is always greener I imagine that if we really did discard personas so lightly, we’d often do so prematurely.

But I worry that instead we go too far in the other direction. In Silicon Valley, at least, it’s easy to develop a tunnel vision which I will summarize in the following table. The middle column is somewhat hyperbolic [1], but the right column is (at least loosely) based on actual conversations I have had with people in Oxford.
Complete The Following Sentence
Answer in Silicon Valley
Other Possible Answers
“The fundamental problem is…”
“...our MySQL server won’t sync with the cloud.”
“...the lack of objective morality in a post-modern world.”
“You have to be careful when you sneak into…”
“...the front of the line at the Google cafeteria.”
“You can use social media to…”
“...disrupt the groups-larger-than-three-but-smaller-than-five space.”
“...represent the parents of the children who died at Newtown.”

There is such a range of ways to live! People here put on black robes for dinner and say grace in Latin and sit at “high table” so they can look down on us mortals and it all seems so absurd to me but they have been doing this for eight hundred years. And at the Oxford Union, the debating society, I see eighteen-year-olds in tuxedos giving grandiose speeches on subjects they don’t understand, playing at being members of parliament, and again it seems absurd to me -- but there’s a decent chance they really will be members of parliament. (I have also, incidentally, seen and heard of more sexism, racism, and classism in a month here than I did in a year working in tech companies, but we can talk about that another time.)

Perhaps more important, I think, than these differences in lifestyle is the diversity in worldviews. Part of this I’ve seen from the people who come to speak at Oxford: three-star generals who stand up and defend the Iraq War and Jan Brewer who says that the only thing Obama has done right is “be a good father”. Part of it is due to the other Rhodes scholars. It's nice to meet a bunch of people who don't, usually, code, and hear what it's really like to march in Ferguson and how one sneaks into Burma and what the hell is going on with Turkey and how you get water to remote Latin American towns and why you need boots on the ground to conduct an airstrike at all and why it’s so hard to prosecute war crimes and...

The part that really bakes my noodle is that, of course, even this relative diversity is only a tiny slice of human experience. In Palo Alto they drink $4 coffee, and in Oxford they drink $4 tea: this is a long way from how most people live. I realized that I could not remember the last time I’d had a long conversation with someone who hadn’t gone to college. (Can you?) Perhaps this shouldn’t surprise me, given my previous work on how birds of a feather flock together; we are astonishingly good at self-segregation, and we build complex mechanisms to facilitate it. After I did the birds-of-a-feather work, I was somewhat troubled to find that someone had used my results to support their dating app that only allows in elites. I’m now at a university where iron gates separate the black-robed students from the beggars outside, where even the way someone speaks is a clue to their class; I don’t think we need to build more walls.

Anyway, hit me up if you’re in Oxford and, assuming I don’t get hit by a car on the wrong side of the road, I’ll keep you posted on the other things I learn in England; also, if you have cool ideas for using statistics to understand the British, shoot me an email.


[1] I should also mention that Stanford, of course, has very strong humanities departments and students (indeed, the other two Rhodes scholars from my year studied history and political science) even if Palo Alto feels extremely tech-focused.
[2] I should perhaps clarify that I do not believe one needs to have spiky hair, or play the harmonica, to flirt successfully with lesbians in Central Park. Indeed, I don't have any idea how one flirts with lesbians in Central Park, or even if there are any to flirt with. Sadly, for the reasons discussed above, I will probably remain ignorant, but feel free to enlighten me.