Jeff Leek — Data Analysis as Art, Causation Creep, and Publishing with Leanpub

Jeff Leek is Associate Professor of Biostatistics and Oncology at the Johns Hopkins Bloomberg School of Public Health and co-director of the Johns Hopkins Data Science Specialization on Coursera. He is the author of the Leanpub book The Elements of Data Analytic Style. In this interview with Len Epp, Jeff discusses biostatistics, the art of data analysis, causation creep and data dredging, teaching data science at scale, and his experience publishing with Leanpub.

Len Epp: I usually like to start these interviews by asking people for their origin story. Can you tell me how you first became interested in biostatistics and what led you to where you are?

Jeff Leek: Yeah, sure. At the time I first got interested in biostatistics, I was an undergraduate student at Utah State University out west, studying mathematical ecology. I was studying how mountain pine beetle outbreaks are coordinated and how they attack trees. It’s actually a major problem. You read about it in National Geographic a lot, about how these mountain pine beetles are devastating huge swaths of the forests out in the western United States. When I first started working as an undergraduate student, I got a research assistantship where I got paid to camp. It was the best job I’ve ever had, probably including the one I have now, and I like my job a lot.

I would go out and collect these mountain pine beetle outbreak data. We’d count how many beetles hit which trees at which time, and then I started analyzing a little bit and got into that. At the time there was a statistician on the faculty in the math department where I was working, and he suggested biostatistics. When I applied to graduate school, I applied to both math departments and biostat departments, and the biostat department seemed like they had happier students. So I went into biostat serendipitously, did my graduate work in statistical genomics, studying human genomes and the data around human genomes, did a postdoc and then ended up here as a faculty member. Beetles is what led to data.

Len: Can you explain a little bit about just what biostatistics is for those who might not be familiar with it?

Jeff: Sure. Biostatistics is a field that applies the ideas of statistics, which you might think of as this boring subject. I often hear that when I tell people at parties or whatever, but it’s actually quite a fascinating subject. It’s how do you take a small amount of information or a large amount of information in the form of data and turn it into some kind of knowledge you can use, whether that’s through a clinical trial and trying to decide if a drug works, or whether it’s analyzing the human genome and trying to figure out which genetic variants are associated with which diseases. Or now, in a more modern sense, how do you decide which links people will click on on a website? All of that is data.

Biostatistics mostly applies to how do you do that in the context of clinical trials, or images of, say, your brain or your heart, or data we’ve collected about your genome. So it’s how do you take that information and turn it into decisions about your health.

Len: Can you give me an example of how biostatistics would be used in oncology?

Jeff: A really common example: there are certain genetic variants that if you have them, certain chemotherapies work better for you. How do we figure that out? Through a statistical analysis, we took a whole bunch of patients, figured out how they responded to chemotherapy, measured stuff about their genomes, tried to associate those two things together, filter out which are the parts that give us information about how does that chemotherapy work. There’s a lot of other examples. If you ever read in the news that some new drug has been approved by the FDA, that was the result of a biostatistician analyzing the data set. They did a trial, they randomized some people to get the drug, some other people to get a different drug, and then a statistician analyzed that data and tried to detect which one worked better. That happens a lot, not just in oncology, but in every aspect of human health.

Len: Just back to the mountain pine beetle for a moment. When I was an undergrad, my summer job was tree planting in British Columbia, so I spent a lot of time in camps. I’m sure you still follow it, but what’s the current state of affairs there? Just for anyone listening, it’s been truly devastating to the forests in the northwest of the United States and the southwest of western Canada. One hears stories about areas the size of Germany being devastated.

Jeff: Yeah, I do follow it, mostly not as a researcher now, but as an interested amateur. I grew up in Idaho, I still go back to the Northwest a lot to see my family. The Sawtooth National Recreation Area is a great place to go, but you’ll go into parts of it and now all the trees are either gray or red because huge swaths of the forest have been knocked out. It’s going pretty badly, in the sense that as temperatures are warming, the beetles get more and more habitat that they can survive in. It’s moving more and more north into Canada, actually, because the climate is becoming conducive to the pine beetles surviving there.

I think it’s a pretty serious ecological problem that, as far as I know, there’s no solid answer to how to resolve. At least at the time when I was doing the research, the only way to prevent the beetles from taking out a tree was to spend quite a bit of money, I think maybe a few dollars a tree, to spray the tree down. That gets pretty expensive when you’re talking about areas the size of Germany. Again, now I’m just an interested amateur, you’d have to ask the researchers in the field, but all the maps I see and all the times I go visit those areas, it’s pretty grim right now.

Len: You mentioned you’re watching this not as a researcher, but as someone interested. You had a blog post recently on Simply Statistics about that, actually. You cited Jon Stewart talking to a physicist who was asked to comment about climate change or fossil fuels. Can you explain what you were getting at in that, because it was a really interesting post?

Jeff: I think it was Lisa Randall was the physicist that Stewart was talking to, and he asked her, basically, why haven’t we solved the fossil fuel crisis? She’s a physicist, quite a theoretical physicist. She answered the question about as well as you could possibly answer it by saying that, while she knows a lot, she’s clearly very well qualified, that’s not her area of expertise and she couldn’t answer that question. That’s a current problem in society, it’s very hard to tell the credentials of somebody. You hear so-and-so PhD, but what does that mean? You could get your PhD in a lot of things, and just because you have your PhD in literature doesn’t mean you’re qualified to tell people about their health, or I wouldn’t be qualified to tell anybody anything about history necessarily.

I call that residual expertise, where you get your main expertise and then you look expert to everybody else just by virtue of the fact that you’re a PhD or an MD or whatever. That residual expertise is being used in lots of different political ways now. Whether it’s you line up experts against some idea you don’t like, whether it’s evolution or the link between autism and vaccines or whatever it is, the best way to get experts, quote unquote experts, to talk about your idea in whichever way you want is to pick people that aren’t necessarily expert in that area. They don’t know as much, their opinions might not be as well formed.

That’s why I try to qualify when I say things that aren’t in my scientific area of expertise. I don’t actually have expertise in the area of mountain pine beetles now. I can tell you only what I read in National Geographic.

Len: I really take your point there. From my perspective, one of the more pernicious examples I see of that is people who’ve been successful in business and then claim expertise in the economy. Running a business and understanding the economy are actually completely different things. But nonetheless, because money’s involved in both, people associate managing a group of people who are doing work with understanding interest rates and currency valuations.

Jeff: Certainly that’s true. The more that you can draw any kind of a common thread between what you used to do before and what you’re trying to talk about, the more people will believe. Like being a data scientist right now, in the sense that I analyze data, a very particular type of data, but could very easily try to adapt that to a bunch of different things. I hadn’t thought about the example of business people in the economy, but I think that’s probably true.

Len: I used to be an investment banker and it’s very frustrating to me to see people who are managers play the role of being economists. It’s not the same thing at all. But moving on, in your book you say data analysis is at least as much art as it is science. Could you explain what you meant by that?

Jeff: That’s a great question. When you learn about data analysis in school, typically you learn it in the context of a statistics class or maybe the end of an econometrics class, where they start to teach you how to actually work with real data. It comes from the history of the field, that statistics and analyzing data grew out of very mathematical fields. There’s this idea that you can always write down an equation for how the data are going to behave, and that’s almost never true. The data that you get out of almost any system is complicated and there’s all sorts of reasons why it’s messed up. An example would be from the pine beetle case, there was a day I slept in, don’t tell my old bosses, and missed the counts for that day.

The way you would mark it is you just put NA or whatever, but then somebody going back and analyzing that data has to account for the fact that a graduate student slept in that day, which is not something you can nicely model with an equation. You just have to deal with the fuzziness of the data. Whenever those sorts of things happen, you have to make lots of basically arbitrary decisions. Do you skip that day? Do you try to impute the missing values, predict what they were? What decision you make about that is a human behavioral choice, and it depends a lot on where you were trained. If you went to school at a certain place, they’ll tell you to do one thing. If you went to school at a different place, you probably got taught to do something else. And also just your own perception.

That’s the art of data analysis. Anything beyond these beautiful equations you can use to describe how a linear model fits, or any of the standard statistical ideas of how to calculate a p-value, the central limit theorem, all that. In real data, most of it is a series of somewhat arbitrary decisions that mostly you only learn how to make well after having had experience doing it.

Len: You have a really interesting section called Common Mistakes. In one subsection, you write about the conflation of inferential and causal analysis, spurious correlations, and causation creep. Could you go into what causation creep is and why it’s a problem?

Jeff: There’s a few ideas packed in there, all related to each other. When you’re analyzing a data set, it’s very hard, even if you find that two variables are related. The most common example of this is if you plot how many ice cream cones people buy and how many murders occur in a city. Those two things will be correlated with each other in almost every city in the world. That’s not because ice cream eating causes murderous intent. It’s just because in the hot months, people will eat more ice cream, and more murders occur in hot months because people are out and they’re interacting more. So there’s a correlation between those two variables, but you can’t say that ice cream eating causes murder.

Similarly in almost any analysis you do of data, say in the medical field, if you don’t take very careful steps, you can detect correlations between all sorts of variables. A headline I saw once was Facebook causes cancer. You read a lot of Facebook so you’ll get cancer. That’s probably not true. They probably just analyzed this gigantic data set that wasn’t carefully curated and found a correlation and reported it. The way that happened likely is the original authors of the study were very careful not to say it was a causal relationship. They probably said something like, “we observed a correlation between Facebook and cancer in this population.” But then somebody, either them or maybe the editor in an editorial wrote, “well, it looks like Facebook might cause cancer.” And then somebody else says Facebook causes cancer. You can see the progression of the language from, “oh, we observed an interesting correlation” to “this causes that.” So causal creep, at least as I define it, is the creeping of causal language into a description of an analysis that really can’t tell you which one caused which.

Len: I imagine reading the popular science news sections on websites must really be frustrating for you, because half of them seem to be based on a journalist just taking the opportunity to say something, based on some research they read a summary of.

Jeff: That’s certainly frustrating. The one thing that’s been really frustrating is as a parent. I have two young children, and there’s always news about if you do this for your kids or do that for your kids, they’ll be fine, or they’ll turn into malformed mutants or whatever it is. If you don’t know how to look into the details of the study, you can be snowed by information that clearly isn’t true. One of my favorite pet peeves is this often discussed connection between breastfeeding and IQ. If you breastfeed your kids for longer they’ll have higher IQs. But that’s one of these notoriously hard things to study well, because it’s very hard to randomize women to breastfeed or not breastfeed. You often will see claims about breastfeeding that are based on observational data, which makes it very hard to make real causal claims. That makes it really hard to understand what’s really happening, but there’s understandably a lot of emotion tied to what that answer might be. So that one comes up a lot.

Len: You also have a section on data dredging, where you quote the British economist Ronald Coase as saying, and I just love this quote, “if you torture the data enough, nature will always confess.” Can you explain what he meant by that?

Jeff: It goes back to that same art idea of data analysis. Since most of data analysis boils down to a series of decisions that have to be made by a human, if you’re nefarious, if you really want the data to say something, you can make all those decisions in such a way that you’ll get the answer you want. Here’s an example. Suppose I take all the data for two stocks and I want the prices to be correlated with each other, but it turns out when I look at them they’re not correlated at all. If I take all the times where stock one is high and stock two is low and just throw those out, and throw out all the times when stock two is high and stock one is low, so now I only have the data points where they’re both high at the same time or both low at the same time, then they’ll be very correlated.

That’s an extreme example, of course, but there’s also subtler ways in which, by making a lot of intermediate choices, you can arrive at the final answer you’re trying to get. So there’s a concern in the scientific community, the data analysis community, that we need to be careful about knowing what all the intermediate steps were, knowing how many times you fit a predictive model. Did you try every possible combination of variables until you found one that worked, or did you very carefully hold out a data set to check your predictions on? There’s lots of ways you can manipulate the data, if you mean to do it or even by accident. I think the more common reason is not nefarious. People try a bunch of things and they just stop when it gives them the answer that they want. They weren’t trying to be bad. They just got to the answer they wanted and so they quit.

Len: It’s really fascinating, especially as you’re bringing up stocks. If you want to see how creative people can be interpreting data, just give them a stock chart and let them go. They’ll bring the knowledge they have of what’s going on in the world and also their interests and their desires to it. Nothing confers more validity upon the wildest claims than just putting numbers to them. It almost has a magical effect on people. You have a line in your book where you talk about how the dramatic change in the price and accessibility of data demands a new focus on data analytic literacy. Is that related to this, that because of computers people can interact with data in a way they couldn’t even 30 years ago?

Jeff: There’s two levels at which I think about that problem. One is exactly what you’re talking about, which is that good computing, free computing even, has made it really easy for anybody to make charts of two variables and plot them against each other. Once you do that, inevitably you’ll run into some things that will look like there’s a relationship even when there’s not. Data analysis training isn’t something that we give most people. Only a certain subset of the population gets trained on how to be aware of the fact that two stocks might look correlated even when they’re not. We don’t teach people that in grade school. We teach them reading and writing and arithmetic, but we don’t teach them, “oh, if you make too many charts eventually you’ll find one that’s a false relationship.” That’s something we don’t teach people but maybe should.

Even more than that, I think it’s even more subtly ingrained into everything you do in life, even if you don’t think about it, more than it used to be. I wake up in the morning and I look at the weather, and I have to assign some credibility to whether I believe the app that tells me what the weather is going to be. If you watch any sports games, they’re always talking about this is the first person since so-and-so in 1973 to have this many goals and this many assists, halfway through the first period. You’re saturated with people talking about statistics and numbers and trying, exactly like you said, to give themselves an aura of credibility by talking about numbers, especially precise numbers. We haven’t been trained in general as a population to be skeptical or to identify what are the potential flaws with those numbers, and I think it allows people to get away with stuff. Politicians giving speeches and making wild claims with numbers that if you just step back and think about the actual claim, you think no way that’s true. But they said “oh, it’s a 3.2 percent increase,” and you think, well, 3.2 percent, they clearly calculated that number, but maybe they even haven’t. Almost everyone is doing some form of data analysis every day now, but we don’t have it as part of the standard daily life curriculum.

Len: But you are engaged in a pretty wide effort to help educate people, through this specialization in data science on Coursera, which, as I said in the introduction, has 1.76 million people at last count participating in it. Could you explain a little bit about the specialization, what it is, that it’s free, and why it’s been such a success?

Jeff: I’m just as surprised as anyone else that that many people wanted to learn data science. I remember a very specific conversation with Roger when we originally launched our first Coursera classes, and we said, “wouldn’t it be cool if like 2000 people took our stats classes.” Obviously we’re a couple of orders of magnitude bigger than that now. The data science classes cover how to use the R programming language to do the whole data science process, from getting the data to cleaning it up to analyzing it to making reports. That particular skill is in such high demand right now. It wasn’t in demand and became in demand over a very short period of time, and there weren’t that many resources available. If you didn’t know how to analyze data you could have gone back to school to learn it, or this is one of the first freely available, always available resources for learning how to do that. The classes are free. If you want a certificate that you can put on LinkedIn you pay a small amount, I think it’s like fifty dollars a class, through Coursera. The fact that it was really available, the fact that it was timed well, got people excited about it. But it makes me happy that there are lots of people interested in learning how to do data analysis and data science.

Len: I was looking at one of your talks online, and I think there was an email exchange between yourself and Roger Peng, your colleague, where you said, “I’ve got 7,000 students,” and he replied in more colorful language, “you’re screwed.” Does the fact that there’s 1.76 million people affect your workload, or is the way Coursera is set up just so efficient that it doesn’t really impact anything?

Jeff: It definitely affects workload, but maybe not as dramatically as it would if they were in person. First of all, Coursera and us have recruited people from the classes, community TAs who are amazing, outstanding folks who answer lots of questions on discussion boards. We answer questions on the discussion boards too, but at this point the classes have been running for a long time, so the same questions come up over and over again, so you can anticipate the usual set of questions. We have nine classes in the sequence, they all run every single month, so we’re getting a lot of data back on which parts are hard, which parts are easy, and we can take advantage of that. And then it isn’t quite the same experience taking a class online. Each person doesn’t get as big a fraction of my attention as when I teach a class here in person for 10 people, where it’s much easier to give everybody personalized attention. People tend to work a little bit more independently on the Coursera platform. It has added a workload in the sense that Roger, Brian, and I didn’t think it was going to turn into this huge enterprise, but now it’s got a life of its own and its own obligations and responsibilities. But it’s been such a rocket ship that it’s been fun to take on the new challenges.

Len: That’s fantastic. Congratulations. So I wanted to ask you a couple of questions about Leanpub. I’m curious how you found out about Leanpub and why you chose to use it for your book.

Jeff: I think it was Brian Caffo actually who led us. Brian’s a colleague of mine that teaches in the same specialization. He was writing a book and was looking around for the right place to do it. He’s a tools geek, so he’s always checking out the latest, coolest, easiest or hardest way to do something. He got really into Leanpub, so he wrote his book and released it first on Leanpub. We wrote all of our lectures in Markdown for the specialization, so we were all really comfortable with Markdown.

He said, “I found this awesome tool in Leanpub, you can write in Markdown, you can even take some of the material from your lecture notes and convert it more easily into the start of a book chapter.” And he told us how simple the system is, to write it and turn it into all the different formats and then launch the book without having to go through all the usual process. All of us have worked on academic books, and that publishing process can be a bit long and tedious. The speed with which we could do things was very exciting for us. He launched his book and it was pretty successful, then I launched mine and Roger launched his, and we’ve all been just blown away. I don’t think any of us will ever go back to publishing any other way.

Len: I wanted to ask specifically about academic publishing. The pace of change is accelerating these days, and the speed with which people can communicate their ideas is changing. Do you think there’s a fundamental mismatch with the conventional academic publishing model, which can take a year just to get an article in a journal?

Jeff: Yeah, I do think there’s a mismatch. Right now the way I’m seeing that manifest in journal publishing is that people are using preprints pretty extensively. It’s very common now, my group does this a lot, to write a paper with a student, and when you submit it to the journal you also post it on a publicly facing web server. One of the most famous ones is arXiv, and bioRxiv is the biology one. You just post your paper there, and everybody starts reading it while the paper is being peer reviewed. When it’s on those sites, it’s not peer reviewed yet, so everybody knows to take it with a grain of salt, things might not be totally worked out yet. But you don’t want to put something up there that’s embarrassing either. Your scientific colleagues are all going to read it, so you don’t just post anything. That’s improved the speed that way.

In terms of publishing books, that’s still a pretty slow process and a pretty hard process, and it’s not clear that that’s caught up with the internet age either. The publishing policies of academics are very slow adopting internet style communication. It’s starting to accelerate. Over the last three years I’ve seen a lot more posting things online, tweeting about it, that sort of thing, but that seems pretty new.

Len: It’s interesting, because in a way the most important part of that process is putting the text out there and having the community engage with it, whether it’s formal peer review through a journal or the informal peer review that happens as soon as you post it to arXiv. With your Leanpub book, was that kind of interaction important to you? Obviously not peer review style engagement, but people telling you even something as minor as a typo, or “I wish you’d written about this or that.”

Jeff: Yeah, I’ve been getting a huge amount, especially typos, because speed has been a hallmark of the things that we’ve done around here, which doesn’t mean we always catch every typo. I’ve gotten a long list of typos, which I’m slowly working my way through. One thing I like about the platform is that once I get through those, I’m going to release a new version of the book and everybody gets it again. I like that component of the process, the ability to release it quickly, make edits, and not feel like I’m hurting the people that paid for it. So far it’s just typos, nobody’s found any errors, thank goodness. The iterative nature of it is nice. It means you don’t have to put out that perfect product the first time, which is very hard to do, especially for something the length of a book. You’re almost guaranteed to have a few typos in there, and it’s easier when there’s a thousand people reading it and checking for typos than if you only have one editor or one friend looking it over.

Len: That’s great. That’s obviously our premise, that a better way to write books than sitting in stealth mode, working alone in the cabin for a couple years and then releasing something that’s supposed to be finished, is to get it out there earlier and start interacting with people and getting their feedback, and that will improve your book dramatically.

Jeff: That’s certainly been true for me. I think Roger, Brian, and I have the advantage of already having a built-in large group of people that might be interested, given that we teach these big classes and the things we talk about in our books are related to those classes. That’s made typo identification a very quick process. I’m the bottleneck. The identification of the typos wasn’t the bottleneck, it’s me having time to correct them all and release the new version. When you have a built-in audience especially, it’s just so much more efficient to get the typos corrected post publication than pre-publication.

Len: Is there anything about Leanpub that we could improve for you? You can be as blunt as you want. I’m the type of person who shouts at the computer when I’m using things and they don’t work. Was there any kind of shout at the computer thing about Leanpub that you encountered?

Jeff: I didn’t have too much. Mine is a little bit easier. I think maybe some of the code and equation stuff was a little bit more challenging for my friends Roger and Brian, who had to do more code and equations than I did. The one thing I wish Leanpub had was a really easy hard copy publishing approach, something like CreateSpace style. I’ve gotten quite a few requests now for hard copies of the book, and so far I’ve just been deferring that because I haven’t had a good approach. I’ve looked into some other hard copy publishing approaches and they’re not as slick. The thing I liked about Leanpub was how easy it made things for me. Given that we’re running these classes on the side and we’re professors, I don’t have a huge amount of time to devote to getting my publishing software to work the way I wanted. We’ve even made suggestions to Coursera and other places about ways they can make their system more Leanpub-like, in the sense that it would be easier for people to update and upload things. That is the killer feature.

Len: Thanks a lot for that. We’ve tried to accommodate that need as much as we can without actually doing it ourselves, by having a print version output option. You write your Leanpub book the normal way, but you can also export a version that’s optimized for uploading to Lulu and things like that. Leanpub getting into the production of paper books is probably a long ways away.

Jeff: I figured. Even if it was just an agreement where there was a push button, you just send it to one of those organizations instead of us, where you don’t even have to build the infrastructure yourself. But honestly, given that that’s my only suggestion, you can tell for the most part I’m very pleased with the platform. Things went very smoothly for me. I really didn’t have any problems. I’m already starting on my second Leanpub book.

Len: Actually that was going to be my last question. I see that you have an unpublished book called We Are All Statisticians Now. Is that the book you were referring to?

Jeff: I have that one, and I’m a person that starts things relentlessly, maybe doesn’t finish all of them. The one I’m working on mostly right now is that issue of how do you deal with health information in your day-to-day life. My wife and I are both statisticians, and whenever we talk about health headlines, there’s a language we use about them, how we determine whether we believe them. If it says we should be giving our kid more sweet potatoes or whatever, there’s a series of questions my wife will ask me before she’ll believe that it’s true. So I’m working on a book, I’m hoping I can eventually convince her to collaborate with me on it, where we talk about what are the questions that two statisticians ask each other when reading about health news, and how do you evaluate critically whether the study behind the headline is really something you should be paying attention to or whether you should just ditch it.

Len: That sounds like a really great idea. Thanks very much for being on the Lean Publishing podcast and for being a Leanpub author.

Jeff: Thank you very much. I really appreciate you taking the time to talk to me.