Preface

Over the past 20 years there has been no shortage of the development of statistics and data science textbooks and their corresponding courses. Data science, however broadly defined, has become very popular, with various university programs being developed, including undergraduate, master’s, and doctoral degree programs. As such, data science is not a new field and it is useful to consider what are the core methodological elements of the field. This textbook is an attempt to incorporate what we have learned over the past 20 years teaching data science and doing data science research.

In the early 2000s, the statistics curriculum was still largely focused on mathematical treatments of data analysis. Many statistics courses were taught without the need for computers at all (a simple Normal distribution table at the back of the textbook was all that was needed). But the rise of computing, the Internet, and the need for programming skill was undeniable, so significant efforts were made to introduce computing into the statistics curriculum. Those efforts were generally successful and many undergraduate statistics programs incorporated programming and other computing topics into their required coursework. The thinking at the time was that statisticians needed to know advanced computing topics and could not afford to outsource these ideas to people in other fields. The introduction of these computing topics came at the expense of detailed mathematical treatments that had been taught previously.

The combination of the traditional statistics curriculum and the new computing topic areas eventually became the core of what we now call the data science curriculum. If you look at the table of contents of introductory data science textbooks, they typically contain a mix of statistical and computing-related topics. Books in the statistical domain often focus on the R programming language but books in other areas use other equally effective programming languages. A core focus of data science courses is the idea of getting hands-on experience with real data, which requires knowledge of programming and computing. At this point, one might reasonably wonder if in fact there is anything important missing from the curriculum. However, we believe the introductory data science course needs to continue to evolve and adapt with the times.

This book is designed with two broad organizing principles in mind. The first is the basic idea that programming and data analysis are not the same thing. In particular, being good at one of these does not imply much about being good at the other. It is certainly true that having solid programming skills is a requirement for implementing a data analysis. However, we contend that there are higher level skills involved in designing a data analysis and extracting useful evidence from data, and we choose to focus on those skills in this book. A consequence of this organizing principle is that there are no code examples in this book. As a practical matter, if using this book to teach an introductory data analysis course, separate instruction on programming in a language like R or Python will be needed. Indeed, when we teach this course at the University of Texas, we have lab sessions and exercises in R programming. However, we believe that separating the instruction of programming from data analysis communicates the idea that these are distinct areas of study.

The second organizing principle is that there should be a sharp distinction between the ideal world and the real world of data analysis. There has been a trend in recent decades towards introducing more of the “real world” into textbooks about data science. The thinking is that real-world data science can be quite messy or complicated, and students should be introduced to these complexities so that they are better prepared to handle them in the future. However, in our experience, inundating students with real-world complexity in an introductory course can cause confusion. Importantly, it can be difficult for students to understand what concepts are generalizable and what concepts are particular to a given problem. The first few chapters of the book largely imagine data analysis as it might occur in an ideal setting where nothing unexpected happens. Although this is unrealistic, from a pedagogical perspective, we have chosen to introduce techniques that are new to the user without the various distractions regarding what could go wrong.

Of course, we do not deny that the real world exists, and we cannot ignore the complexities of data in the real world. But in this book, we focus primarily on the “ideal world” and on showing what different kinds of data analyses should look like. The goal is to set expectations for what is appropriate and what is a well-behaved analysis. In the last two chapters we discuss how data analysis works in the real world and provide some case studies of how the ideal world can be marred by real-world complexity. Our hope is that once students have become accustomed to seeing what a data analysis should look like, they will be able to identify unexpected aspects of an analysis when they come up.

The key contributions of this book are found in the very beginning and at the end. The first three chapters deal with the basics of thinking about the data-generating process, knowing your dataset, and specifying your question. These concepts are critical to engage with before diving into the dataset and analyzing the data. It is all too easy to get engaged with a data analysis, making plots and computing summaries, before even asking “What question are we trying to answer here?”

Chapters 10–11 provide a brief introduction to the topic of statistical causal inference. In many scenarios, we are interested in understanding the underlying mechanisms that produce the data we observe. Very often these mechanisms can be thought of as causal, with one part of a phenomenon causing changes to another part. There have been significant advances in the formal treatment of causal reasoning, as well as explicit statistical approaches to estimating causal effects. Having exposure to these ideas can enhance the application of statistical methods and guide a novice data scientist to moving an analysis forward.

Causal inference is typically a topic that is taught at the graduate level and is often avoided in statistics and data science courses. However, there are important concepts covered here that are key to designing good data analyses. We do not believe there is a need to shy away from this topic, even in an introductory course, and there are some analysis methods (such as matching) that can be understood at this level.

Chapters 12–13 discuss data analysis in the real world and attempt to give just a brief introduction to how it is done in practice and how things might go wrong. Given that the nature of how things can go wrong is complex and high-dimensional, we only give a small sample of those possibilities here. Ideally, these last two chapters would serve as a lead in to some future course on advanced data analysis techniques.

One idea that is the focus of Chapter 12 and we believe has been underrepresented in data science books is the the development of alternative explanations. The development of alternative explanations of the data that are equally consistent with what is observed is a key skill for allowing data analyses to move forward. Because the alternatives are equally consistent with the observed results, new analyses of the data must be conducted to discriminate between the alternative explanations. Part of being good at developing alternative explanations is being able to characterize the possible causal or mechanistic processes that might generate the data.

The development of alternative explanations ultimately serves as the foundation of what we call the mechanics of analytic iteration. Data analysis is often characterized as an iterative process, but less commonly is there explicit instruction as to how to drive that iteration forward. In particular, what is it about the analysis that forces the analyst to go backwards into the analytic process and try something different? Why would the data need to be re-examined or re-analyzed in an iterative way? The concepts of unexpected and as-expected results, along with the development of alternative explanations and the need to discriminate between them, are the forces that drive analyses forward with goal of understanding of the data-generation process.

Every textbook has to make choices about what to present in a constrained amount of space and time. We hope that the approach taken here achieves the goal of presenting these ideas in a manner that can make for a complete introductory data science course.