AA Data Science Course for Undergraduates:Thinking with Data
Ben Baumer, Smith CollegeMarch 20, 2015
Abstract
Data science is an emerging interdisciplinary field that combines elements of mathematics,statistics, computer science, and knowledge in a particular application domain for the purposeof extracting meaningful information from the increasingly sophisticated array of data availablein many settings. These data tend to be non-traditional, in the sense that they are often live,large, complex, and/or messy. A first course in statistics at the undergraduate level typicallyintroduces students with a variety of techniques to analyze small, neat, and clean data sets.However, whether they pursue more formal training in statistics or not, many of these stu-dents will end up working with data that is considerably more complex, and will need facilitywith statistical computing techniques. More importantly, these students require a frameworkfor thinking structurally about data. We describe an undergraduate course in a liberal artsenvironment that provides students with the tools necessary to apply data science. The courseemphasizes modern, practical, and useful skills that cover the full data analysis spectrum, fromasking an interesting question to acquiring, managing, manipulating, processing, querying, an-alyzing, and visualizing data, as well communicating findings in written, graphical, and oralforms.Keywords: data science, data wrangling, statistical computing, undergraduate curriculum,data visualization, machine learning, computational statistics
The last decade has brought considerable attention to the field of statistics, as undergraduate en-rollments have swollen across the country. Fueling the interest in statistics is the proliferation ofdata being generated by scientists, large Internet companies, and seemingly just about everyone.There is widespread acknowledgement—coming naturally from scientists, but also from CEOs andgovernment officials—that these data could be useful for informing decisions. Accordingly, the jobmarket for people who can translate these data into actionable information is very strong, and thereis evidence that demand for this type of labor far exceeds supply (Harris et al., 2014). By all ac-counts, students are eager to develop their ability to analyze data, and are wisely investing in theseskills.But while this data onslaught has strengthened interest in statistics, it has also brought chal-lenges. Modern data streams are importantly different than the data with which many statisticians,and in turn many statistics students, are accustomed to working. For example, the typical dataset a student encounters in an introductory statistics course consists of a few dozen rows and threeor four columns of non-collinear variables, collected from a simple random sample. These are datathat are likely to meet the conditions necessary for statistical inference in a multiple regressionmodel. From a pedagogical point-of-view, this makes both the students and the instructor happy,because the data fits the model, and thus we can proceed to apply the techniques we have learnedto draw meaningful conclusions. However, the data that many of our current students will be askedto analyze—especially if they go into government or industry—will not be so neat and tidy. Indeed,these data are not likely to come from an experiment—they are much more likely to be observa-tional. Secondly, they will not likely come in a two-dimensional row-and-column format—they might1 a r X i v : . [ s t a t . O T ] M a r e stored in a database, or a structured text document (e.g. XML), or come from more than onesource with no obvious connecting identifier, or worse, have no structure at all (e.g. data scrapedfrom the web). These data might not exist at a fixed moment in time, but rather be part of a livestream (e.g. Twitter). These data might not even be numerical, but rather consist of text, images,or video. Finally, these data may consist of so many observations, that many traditional inferentialtechniques might not make sense to use, or even be computationally feasible.In 2009, Hal Varian, chief economist at Google, described statistician as the “sexy job in the next10 years” (Lohr, 2009). Yet by 2012, the Harvard Business Review used similar logic to declare datascientist as the “sexiest job of the 21st century” (Davenport and Patil, 2012). Speaking at the 2013Joint Statistical Meetings, Nate Silver—as always—helped us to unravel what had happened. Henoted that “data scientist is just a sexed up term for a statistician.” If Silver is right, then the statis-tics curriculum should be updated to include topics that are currently more closely associated withdata science than with statistics (e.g. data visualization, database querying, algorithmic concernsabout computation techniques) . It is clear that statisticians and data scientists, broadly, share acommon goal—namely, to use data appropriately to inform decision-making—but what we describein this paper is a course at a small liberal arts college in data science that is atypical within thecurrent statistics curriculum. Nevertheless, what we present here is wholly consistent with the visionfor the future of the undergraduate statistics curriculum articulated by Horton (2015). The purposeof this course is to prepare students to work with these modern data streams as described above.Some of the topics covered in this course have historically been the purview of computer science.But while the course we describe indisputably contains elements of statistics and computer science,it just as indisputably belongs exclusively to neither discipline. Furthermore, it is not simply acollection of topics from existing courses in statistics and computer science, but rather an integratedpresentation of something more holistic. While many believe that to understand statistical theory, a solid foundation in mathematics isnecessary, it seems clear that computing skills are necessary for one to become a functional, practicingstatistician. In making this analogy Nolan and Temple Lang (2010) argued strongly for a largerpresence for computing in the statistics curriculum. Citing this work, the American StatisticalAssociation Undergraduate Guidelines Workgroup (2014) underscored the importance of computingskills (even using the words “data science”) in the 2014 guidelines for undergraduate majors instatistical science. Here, by computing , we mean statistical programming in an environment suchas R . It is important to recognize this as a distinct—and more valuable—skill than being ableto perform statistical computations in a menu-and-click environment such as Minitab. Indeed,Nolan and Temple Lang (2010) go even further, advocating for the importance of teaching generalcommand-line programs, such as grep (for regular expressions) and other common UNIX commandsthat really have nothing to do with statistics, per se , but are incredibly useful for cleaning andmanipulating documents of many types.Although practicing statisticians seem to largely agree that the lion’s share of the time spenton many projects is devoted to data cleaning and manipulation (or data wrangling , as it is oftencalled (Kandel et al., 2011)), the motivation for adding these skills to the statistics curriculum isnot simply convenience, nor should a lack of skills or interest on the part of instructors stand inthe way. Finzer (2013) describes a “data habit of mind...that grows out of working with data.”(This is not to be confused with “statistical thinking” as articulated by Chance (2002), whichcontains no mention of computing.) In this case, a data habit of mind comes from experienceworking with data, and is manifest in people who start thinking about data formatting before datagets collected (Zhu et al., 2013), and have a foresight about how data should be stored that isinformed by how it will be analyzed. Furthermore, while some might view data management as a The Wikipedia defines “data science” as “the extraction of knowledge from data”, whereas “statistics” is ”thestudy of the collection, analysis, interpretation, presentation, and organization of data.” Does writing an SQL querybelong to both? data entry , there are others thinking more broadly aboutdata. Just as Wilkinson et al. (2006) brought structure to graphics through “grammar,” Wickham(2014); Wickham and Francois (2014) brought structure to data through “verbs.” These commondata manipulation techniques are the practical descendents of theoretical work on data structuresby computer scientists who developed notions of normal forms, relational algebras, and databasemanagement systems.While the emphasis on computing within the statistics curriculum may be growing, it belongsto a larger, more gradual evolution in statistics education towards data analysis—with computers,and encourages us to reflect on shifting boundaries between statistics and computer science. Moore(1998)—viewing statistics as an ongoing quest to “reason about data, variation, and chance”—sawstatistical thinking as a powerful anchor that would prevent statistics from being “overwhelmedby technology.” Cobb has argued both for an increased emphasis on conceptual topics in statis-tics (Cobb, 2011), but also sees the development of statistical theory as an anachronistic consequenceof a lack of computing power (Cobb, 2007). Moreover, while much of statistical theory was designedto make the strongest inference possible from what was often scarce data, our current challenge istrying to extract anything meaningful from abundant data. Breiman et al. (2001) articulated thedistinction between “statistical data models” and “algorithmic models” that in many ways char-acterizes the relationship between statistics and machine learning, viewing the former as being farmore limited than the latter. And while machine learning and data mining have traditionally beensubfields of computer science, Finzer (2013) notes that data science does not have a natural homewithin traditional departments, belonging exclusively to neither mathematics, statistics, or computerscience. Indeed, in Cleveland (2001)’s seminal action plan for data science, he saw data science as a“partnership” between statisticians (i.e. data analysts) and computer scientists.
In this paper we describe an experimental course taught at Smith College in the fall of 2013 andagain in the fall of 2014 called MTH 292: Data Science. In the first year, 18 students completedthe course, as did another 24 in the following year. The prerequisites were an introductory statisticscourse and some programming experience. Existing courses at the University of California-Berkeley,as well as Macalester and St. Olaf Colleges, are the pedagogical cousins of MTH 292.MTH 292 can be separated into a series of two-to-three week modules: data visualization, datamanipulation/data wrangling, computational statistics, machine learning (or statistical learning),additional topics. In what follows we provide greater detail on each of these modules.
Learning Outcomes
In Figure 1, we present a schematic of a modern statistical analysis process,from forming a question to obtaining an answer. In the introductory statistics course, we teacha streamlined version of this process, wherein challenges with the data, computational methods,and visualization and presentation are typically not taught. These processes inform the materialpresented in the data science course. The goal is to produce students who have confidence andfoundational skills—not necessarily expertise—to tackle each step in this modern data analysiscycle, both immediately and in their future careers.
The first class provides an important opportunity to hook students into data science. Since moststudents do not have a firm grasp of what data science is, and in particular, how it differs fromstatistics, Figure 1 can help draw these distinctions. The goal is to illustrate the richness andvibrance of data science, and emphasize its inclusiveness by highlighting the different skills necessary Examples of poor data management abound, but one of the most common is failure to separate the actual datafrom the analysis of that data. Microsoft Excel is a particular villian in this arena, where merged cells, roundinginduced by formatted columns, and recomputed formulas can result in the ultimate disaster: losing the originalrecorded data! uestionDataMethodsInferencePresentationAnswer Data AcquisitionData ProcessingData CleaningData ManagementData StorageData RetrivalData MiningMachine LearningComputationalStatisticsRegression VisualizationData Graphic DesignOration Figure 1: Schematic of the modern statistical analysis process. The introductory statistics course(and in many cases, the undergraduate statistics curriculum) emphasizes the central column. In thisdata science course, we provide instruction into the bubbles to the left and right.for each task. Students should be sure within the first five minutes of the semester that there issomething interesting and useful for them to learn in the course.Next, we engage students immediately by exposing them to a recent, relevant example of datascience. In the fall of 2013, we chose a provocative paper by DiGrazia et al. (2013) that was underreview at the time. Additionally, students are asked to read a rather ambitious editorial in
TheWashington Post written by one of the authors, a sociologist, in which he claims that Twitter willput political pollsters out of work (Rojas, 2013).This is a typical data science research project, in that: • The data being analyzed were scraped from the Internet, not collected from a survey or clinicaltrial. Typical statistical assumptions about random sampling are clearly not met. • The research question was addressed by combining domain knowledge (i.e. knowledge of howCongressional races work) with a data source (Twitter) that had no obvious relevance to oneanother. • A large amount of data (500 million tweets!) was collected (although only 500,000 tweets wereanalyzed)—so large that the data itself was a challenge to manage. In this case, the datawere big enough that the help of the Center for Complex Networks and Systems Research atIndiana University was enlisted. • The project was undertaken by a team of researchers from different fields (i.e. sociology,computing) working in different departments, and bringing different skills to bear on theproblem—a paradigm that many consider to be optimal.Students are then asked to pair up and critically review the paper. The major findings reportedby the authors stem from the interpretation of two scatterplots and two multiple regression models,both of which are accessible to students who have had an introductory statistics course. There areseveral potential weaknesses in both the plots presented in the paper (Linkins, 2013; Gelman, 2013),and the interpretation of the coefficients in the multiple regression model, which some students willidentify. The exercise serves to refresh students’ memories about statistical thinking, encouragethem to think critically about the display of data, and illustrate the potential hazards of drawingconclusions from data in the absence of a statistician. Instructors could also use this discussion as4 segue to topics in experimental design, or introduce the ASA’s Ethical Guidelines for StatisticalPractice (Committee on Professional Ethics, 1999).Finally, students are asked quite literally about how they would go about reproducing this study.That is, they are asked to identify all of the steps necessary to conduct this study, from collecting thedata to writing the paper, and to think about whether they could accomplish this with their currentskills and knowledge. While students are able to generate many of the steps as a broad outline,most are unfamiliar with the practical considerations necessary. For example, students recognizethat the data must be downloaded from Twitter, but few have any idea how to do that. Thisleads to the notion of an API (application programming interface), which is provided by Twitter(and can be used in several environments, notably R and Python). Moreover, most students do notrecognize the potential difficulties of storing 500 million tweets. How big is a tweet? Where andhow could you store them? Spatial concerns also arise: how do you know in which Congressionaldistrict the person who tweeted was? Most students in the class have experience with R , and thus arecomfortable building a regression model and overlaying it on a scatterplot. But few have consideredanything beyond the default plotting options. How do you add annotations to the plot to make itmore understandable? What are the principles of data graphic design that would lead you to thinkcertain annotations are necessary or appropriate?Students are then advised that this course will give them the tools necessary to carry out asimilar study. This will involve improving their skills with programming, data management, datavisualization, and statistical computing. The goal is to leave students feeling energized , but open toexploring their newly-acquired, more complex understanding of data. From the first day of class, students are reminded that statistical work is of limited value unlessit can be communicated to non-statisticians (Swires-Hennessy, 2014). More specifically, most datascientists working in government or industry (as opposed to those working in academia) will workfor a boss who possesses less technical knowledge than she. A perfect, but complicated, statisticalmodel may not be persuasive to non-statisticians if it cannot be communicated clearly. Data graphicsprovide a mechanism for illustrating relationships among data, but most students have never beenexposed to structured ideas about how to create effective data graphics.In MTH 292, the first two weeks of class are devoted to data visualization. This serves twopurposes: 1) it is an engaging hook for a science course in a liberal arts school; and 2) it givesstudents with weaker programming backgrounds a chance to get comfortable in R .Students read the classic text of Tufte (1983) in its entirety, as well as excerpts from Yau (2013).The former provides a wonderfully cantankerous account of what not to do when creating datagraphics, as well as thoughtful analyses of how data graphics should be constructed. My studentstook delight in critiquing data graphics that they had found online through the lens crafted by Tufte.The latter text, along with Yau (2011), provides many examples of interesting data visualizationsthat can be used in the beginning of class to inspire students to think broadly about what can bedone with data (e.g. data art ). Moreover, it provides a well-structured taxonomy for composingdata graphics that give students an orientation into data graphic design. For example, in Yau’staxonomy, a data graphic that uses color as a visual cue in a Cartesian coordinate system is whatwe commonly call a heat map. Students are also exposed to the hierarchy of visual perception thatstems from work by Cleveland (2001).Homework questions from this part of the course focus on demonstrating understanding bycritiquing data graphics found “in the wild,” an exercise that builds confidence (i.e. “Geez, Ialready know more about data visualization that this guy...”). Computational assignments introducestudents to some of the more non-trivial aspects of annotating data graphics in R (e.g. addingtextual annotations and manipulating colors, scales, legends, etc.). We discuss additional topics indata visualization in Section 3.6. 5 .3 Data Manipulation/Data Wrangling As noted earlier, it is a common refrain among statisticians that “cleaning and manipulating thedata” comprises an overwhelming majority of the time spent on a statistical project. In the intro-ductory class, we do everything we can to shield students from this reality, exposing them only tocarefully curated data sets. By contrast, in MTH 292 students are expected to master a variety ofcommon data manipulation techniques. The term data management has a boring, IT connotation,but there is a growing acknowledgement that such data wrangling , or data manipulation skills arenot only valuable, but in fact belong to a broader intellectual discipline (Wickham, 2014). One ofthe primary goals of MTH 292 is to develop students’ capacity to “think with data” (Nolan andTemple Lang, 2010), in both a practical and theoretical sense.Over the next three weeks, students are given rapid instruction in data manipulation in R and SQL . In the spirit of the data manipulation “verbs” advocated by Wickham and Francois (2014),students learn how to perform the most fundamental data operations in both R and SQL , and areasked to think about their connection. • select : subset variables ( SELECT in SQL, select() in R ( dply )) • filter : subset rows ( WHERE, HAVING in SQL, filter() in R ) • mutate : add new columns ( ... AS ... in SQL, mutate() in R ) • summarise : reduce to a single row ( GROUP BY in SQL, summarise(group by()) in R ) • arrange : re-order the rows ( ORDER BY in SQL, arrange() in R )By the end, students are able to see that an SQL query containing
SELECT ... FROM a JOIN b WHERE ... GROUP BY ... HAVING ... ORDER BY ... is equivalent to a chain of R commands involving a %>%select(...) %>%filter(...) %>%inner_join(b, ...) %>%group_by(...) %>%summarise(...) %>%filter(...) %>%arrange(...) A summary of analogous R and SQL syntax is shown in Table 1.Moreover, students learn to determine for themselves, based on the attributes of the data (mostnotably size), which tool is more appropriate for the type of analysis they wish to perform. Theylearn that R stores data in memory, so that the size of the data with which you wish to work islimited by the amount of memory available to the computer, whereas SQL stores data on disk, and isthus much better suited for storage of large amounts of data. However, students learn to appreciatethe virtually limitless array of operations that can be performed on data in R , whereas the numberof useful computational functions in SQL is limited. Thus, students learn to make choices aboutsoftware in the context of hardware—and data.Care must be taken to make sure that what students are learning at this stage of the course isnot purely progamming syntax (although that is a desired side effect). Rather, they are learningmore generally about operations that can be performed on data, in two languages. To reinforce this,students are asked to think about a physical representation of what these operations do. For example,Figure 2 illustrates conceptually what happens when row filtering is performed on a data.frame in R or a table in SQL . Less trivially, Figure 3 illustrates the incredibly useful gather operation in R .6oncept SQL R ( dplyr )Filter by rows & columns SELECT col1, col2 FROM a WHERE col3 = ’x’ select(filter( a , col3 =="x"), col1, col2) Aggregate by rows
SELECT id, sum(col1) astotal FROM a GROUP BY id summarise(group by( a , id),total = sum(col1)) Combine two tables
SELECT * FROM a JOIN b ONa.id = b.id inner join(x= a , y= b ,by="id")) Table 1: Conceptually analogous SQL and R commands. Suppose a and b are SQL tables or R data.frame s n k m ≤ nk Figure 2: The subset operation x y y v v n k xx y y v v nk .4 Computational Statistics Now having the intellectual and practical tools to work with data and visualize it, the third partof the course provides students with computational statistical methods for analyzing data in theinterest of answering a statistical question. There are two major objectives for this section of thecourse:1. Developing comfort constructing interval estimates using resampling techniques (e.g. the boot-strap). Understanding the nature of variation in observational data and the benefit of present-ing interval estimates over point estimates.2. Developing comfort with OLS linear regression, beginning with simple linear regression (whichall students should have already seen in their intro course), but continuing to include multipleand logistic regression, and a few techniques for automated feature selection.The first objective underlines the statistical elements of the course, encouraging students to putobservations in relevant context by demonstrating an understanding of variation in their data. Thesecond objective, while not a substitute for a semester course in regression analysis, helps reinforce apractical understanding of regression, and sets the stage for the subsequent machine learning portionof the course.
Two weeks were devoted to introductory topics in machine learning. Some instructors may findthat this portion of the course overlaps too heavily with existing offerings in computer science orapplied statistics. Others might argue that these topics will not be of interest to students who areprimarily interested in the softer side of data science. However, a brief introduction to machinelearning gives students a functional framework for testing algorithmic models. Assignments forcethem to grapple with the limitations of large data sets, and pursue statistical techniques that arebeyond introductory.In order to understand machine learning, one must recognize the differences between the mindsetof the data miner and the statistician, notably characterized by Breiman et al. (2001), who distin-guished two types of models f for y , the response variable, and x , a vector of explanatory variables.One might consider a data model f such that y ∼ f ( x ), assess whether f could reasonably have beenthe process that generated y from x , and then make inferences about f . The goal here is to learnabout the real process that generated y from x , and the conceit is that f is a meaningful reflectionof the true unknown process. Alternatively, one might construct an algorithmic model f , such that y ∼ f ( x ), and use f to predict unobserved values of y . If it can be determined that f does in factdo a good job of predicting values of y , one might not care to learn much about f . In the formercase, since we want to learn about f , a simpler model may be preferred. Conversely, in the lattercase, since we want to predict new values of y , we may be indifferent to model complexity (otherthan concerns about overfitting and scalability).These are very different perspectives to take towards learning from data, so after reinforcingthe former perspective that students learned in their introductory course, MTH 292 students areexposed to the latter point-of-view. These ideas are further explored in a class discussion aboutChris Anderson’s famous article on The End of Theory (Anderson, 2008), in which he argues thatthe abundance of data and computing power will eliminate the need for scientific modeling.The notions of cross-validation and the confusion matrix frame the machine learning unit (ROCcurves are also presented as an evaluation technique). The goal is typically to predict the outcomeof a binary response variable. Once students understand that these predictions can be evaluatedusing a confusion matrix, and that models can be tested via cross-validation schemes, the rest ofthe unit is spent learning classification techniques. The following techniques were presented, mainlyat a conceptual and practical level: decision/classification trees, random forests, k -nearest neighbor,n¨aive Bayes, aritificial neural networks, and ensemble methods.One of the most satisfying aspects of this unit is that you can now turn students loose on amassive data set. Past instances of the KDD Cup ( )8re an excellent source for such data sets. We explored data from the 2008 KDD Cup on breastcancer. Each of the n observations contained digitized data from an X-Ray image of a breast.Each observation corresponded to a small area of a particular breast, which may or may not depicta malignant tumor—this provided the binary response variable. In addition to a handful of well-defined variables (( x, y )-location, etc.), each observation has 117 nameless attributes, about which noinformation was provided. Knowing nothing about what these variables mean, students recognizedthe need to employ machine learning techniques to sift through them and find relationships. Thesize of the data and number of variables made manual exploration of the data impractical.Students were asked to take part in a multi-stage machine learning “exam” (Cohen and Henle,1995) on this breast cancer data. In the first stage, students had several days to work alone andtry to find the best logistic regression model that fit the data. In the second stage, students formedgroups of three, discussed the strengths and weaknesses of their respective models, and then builta classifier, using any means available to them, that best fit the data. The third stage of the examwas a traditional in-class exam. As outlined above, data visualization, data manipulation, computational statistics, and machinelearning comprise the four pillars of this data science course. However, additional content can belayered in at the instructor’s discretion. We list a few such topics below. Greater detail is providedin our supplementary materials. • Spatial Analysis: creating appropriate and meaningful graphical displays for data that containsgeographic coordinates • Text Mining & Regular Expressions: learning how to use regular expressions to produce datafrom large text documents • Data Expo: exposing students to the questions and challenges that people outside the class-room face with their own data • Network Science: developing methods for data that exists in a network setting (i.e. on a graph) • Big Data: illustrating the next frontier for working with data that is truly large scale
Practical, functional programming ability is essential for a data scientist, and as such no attempt ismade to shield students from the burden of writing their own code. Copious examples are given, anddetailed lecture notes containing annotated computations in R are disseminated each class. Lecturesjump between illustrating concepts on the blackboard and writing code on the computer projectedoverhead, and students are expected to bring their laptops to class each day and participate actively.While it is true that many of the students struggled with the programming aspect of the course,even those that did expressed enthusiasm and satisfaction as they became more comfortable. Newlyfocused on becoming data scientists, several students went on to take subsequent courses on datastructures or algorithms offered by the computer science department during the next semester.In this course, programming occured exclusively in R and SQL. Others may assert that Pythonis necessary, and future incarnations of this course may include more Python. In my view these arethe three must-have languages for data science. SQL is a mature technology that is widely-used, but useful for a specific purpose. R is a flexible, extensibleplatform that is specifically designed for statistical computing, and represents the current state-or-the-art. Pythonhas become something of a lingua franca , capable of performing many of the data analysis operations otherwisedone in R , but also being a full-fledged general purpose programming language with lots of supporting packages anddocumentation.At Smith, all introductory computer science students learn Python, and all introductory statistics students in themathematics and statistics department learn R . However, it is not clear yet how large the intersection of these twogroups is. It is probably easier for those who know Python to learn R than it is for those who know R to learn Python, Assignments
Reading assignments in MTH 292 were culled from a variety of textbooks and articles available forfree online. Non-trivial sections were assigned from (James et al., 2013; Tan et al., 2006; Rajaramanand Ullman, 2011; Murrell, 2010; Stanton, 2012).Concepts from the reading were developed further during the lecture periods in conjuction withimplementations demonstrated in R . Homework, consisting of conceptual questions requiring writtenresponses as well as computational questions requiring coding in R , was due approximately every twoweeks. Two exams were given—both of which had in-class and take-home components. The firstexam was given after the first two modules, and focused on data visualization and data manipulationprinciples demonstrated in written form. The second exam unfolded over two weeks, and focused onthe difficult breast cancer classification problem discussed above. An open-ended project (see below)brought the semester to a close. More details on these assignments, including sample questions, arepresented in our supplementary materials. Project
The culmination of the course was an open-ended term project that students completedin groups of three. Only three conditions were given:1. Your project must be centered around data2. Your project must tell us something3. To get an A, you must show something beyond what we’ve done in classJust like in other statistics courses, the project was segmented so that each group submitted aproposal that had to be approved before the group proceeded (Halvorsen and Moore, 2001). Thefinal deliverable was a 10-minute in-class presentation as well as a written “blog post” crafted in
RMarkdown (Allaire et al., 2013).Examples of successful projects are presented in the supplementary materials.
The feedback that I have received on this course—through informal and formal evaluations—hasbeen nearly universally positive. In particular, the 42 students (mostly from Smith but also includingfive students from three nearby colleges) seemed convinced that they learned “useful things.” Morespecific feedback is available in our supplementary materials.Some of these students were able to channel these useful skills into their careers almost immedi-ately. Internships and job offers followed in the spring for a handful of students in the first offering:two students spent their summers at NIST, and one later accepted a full-time job offer from MIT’sLincoln Laboratory. External validation also came during the Five College DataFest, the inaugurallocal version of the ASA-sponsored data analysis competition (Gould et al., 2014). DataFest is anopen-ended data analysis competition that challenges students working in teams of up to five todevelop insights from a difficult data set. A team of five students from Smith—four of whom hadtaken this course—won the Best In Show prize. In this case, skills developed in the course helpedthese students perform data manipulation tasks with considerably less difficulty than other groups.For example, each observation in this particular data set included a date field, but the values wereencoded as strings of text. Most groups struggled to work sensibly with these data, as familiarworkflows were infeasible (e.g. the data was too large to open in Excel, so “Format Cells...” was nota viable solution). The winning group was able to quickly tokenize this string in R , and—havingjumped this hurdle—had more time to spend on their analysis. and thus the decision was made in this instance to avoid Python and focus on R . Other instructors may make differentchoices without disruption. Discussion
It is clear that the popularity of data science has brought both opportunities and challenges to thestatistics profession. While statisticians are openly grappling with questions about the relationshipof our field to data science (Davidian, 2013a,b; Franck, 2013; Bartlett, 2013), there appears to be lessconflict among computer scientists, who (rightly or wrongly) distinguish data science from statisticson the basis of the heterogeneity and lack of structure of the data with which data scientists, asopposed to statisticians, work (Dhar, 2013). As
Big Data (which is clearly related to—but too oftenelided with—data science) is often associated with computer science, computer scientists tend tohave an inclusive attitude towards data science.A popular joke is that, “a data scientist is a statistician who lives in San Francisco,” but HadleyWickham (2012), a Ph.D. statistician, floated a more cynical take on Twitter: “a data scientistis a statistician who is useful.” Statisticians are the guardians of statistical inference, and it is ourresponsibility to educate practitioners about using models appropriately, and the hazards of ignoringmodel assumptions when making inferences. But many model assumptions are only truly met underidealized conditions, and thus, as Box (1979) eloquently argued, one must think carefully aboutwhen statistical inferences are valid. When they are not, statisticians are caught in the awkwardposition, as Wickham suggests, of always saying “no.” This position can be dissatisfying.If data science represents the new reality for data analysis, then there is a real risk to the fieldof statistics if we fail to embrace it. The damage could come on two fronts: first, we lose datascience and all of the students who are interested in it to computer science; and second, the worldwill become populated by data analysts who don’t fully understand or appreciate the importanceof statistics. While the former blow would be damaging, the latter could be catastrophic—and notjust for our profession. Conversely, while the potential that data science is a fad certainly exists, itseems less likely each day. It is hard to imagine waking up to a future in which decision-makers arenot interested in what data (however it may have been collected and however it may be structured)can offer them.Data science courses like this one provide a mechanism to develop students’ abilities to workwith modern data, and these skills are quickly transitioning from desirable to necessary.
References
Allaire, J., Horner, J., Marti, V., and Porte, N. (2013), markdown : Markdown rendering for R , Rpackage version 0.6.3, http://CRAN.R-project.org/package=markdown .American Statistical Association Undergraduate Guidelines Workgroup (2014), , .Anderson, C. (2008), “The End of Theory,” Wired , .Bartlett, R. (2013), “We Are Data Science,” AMSTAT News , October, http://magazine.amstat.org/blog/2013/10/01/we-are-data-science/ .Box, G. E. (1979), “Some problems of statistics and everyday life,”
Journal of the American Sta-tistical Association , 74, 1–4, .Breiman, L. et al. (2001), “Statistical modeling: The two cultures (with comments and a rejoinderby the author),”
Statistical Science , 16, 199–231, .Chance, B. L. (2002), “Components of Statistical Thinking and Implications for Instruction andAssessment,”
Journal of Statistics Education , 10, . 11leveland, W. S. (2001), “Data science: an action plan for expanding the technical areas of the field ofstatistics,”
International statistical review , 69, 21–26, .Cobb, G. W. (2007), “The Introductory Statistics Course: A Ptolemaic Curriculum?”
TechnologyInnovations in Statistics Education (TISE) , 1, http://escholarship.org/uc/item/6hb3k0nz .— (2011), “Teaching statistics: Some important tensions,”
Chilean Journal of Statistics , 2, 31–62, http://chjs.deuv.cl/Vol2N1/ChJS-02-01-03.pdf .Cohen, D. and Henle, J. (1995), “The Pyramid Exam,”
Undergraduate Mathematics EducationTrends , 7, 2.Committee on Professional Ethics (1999),
Ethical Guidelines for Statistical Practice , .Davenport, T. H. and Patil, D. (2012), “Data Scientist: The Sexiest Job of the 21st Century,” http://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century/ar/1 .Davidian, M. (2013a), “Aren’t We Data Science?” AMSTAT News , July, http://magazine.amstat.org/blog/2013/07/01/datascience/ .— (2013b), “The ASA and Big Data,”
AMSTAT News , June, http://magazine.amstat.org/blog/2013/06/01/the-asa-and-big-data/ .Dhar, V. (2013), “Data Science and Prediction,”
Communications of the ACM , 56, 64–73, http://cacm.acm.org/magazines/2013/12/169933-data-science-and-prediction/fulltext .DiGrazia, J., McKelvey, K., Bollen, J., and Rojas, F. (2013), “More Tweets, More Votes: SocialMedia as a Quantitative Indicator of Political Behavior,”
Social Science Research Network , http://ssrn.com/abstract=2235423 .Finzer, W. (2013), “The Data Science Education Dilemma,” Technology Innovations in StatisticsEducation , 7, http://escholarship.org/uc/item/7gv0q9dc.pdf .Franck, C. (2013), “Is Nate Silver a Statistician?”
AMSTAT News , October, http://magazine.amstat.org/blog/2013/10/01/is-nate-silver/ .Gelman, A. (2013), “The Tweets-Votes Curve,” http://andrewgelman.com/2013/04/24/the-tweets-votes-curve/ .Gould, R., Baumer, B., C¸ etinkaya Rundel, M., and Bray, A. (2014), “Big Data Goes to College,”
AMSTAT News , June, http://magazine.amstat.org/blog/2014/06/01/datafest/ .Halvorsen, K. T. and Moore, T. L. (2001), “Motivating, monitoring, and evaluating studentprojects,”
MAA Notes , 27–32.Harris, J. G., Shetterley, N., Alter, A. E., and Schnell, K. (2014), “It Takes Teams to Solve theData Scientist Shortage,”
The Wall Street Journal , http://blogs.wsj.com/cio/2014/02/14/it-takes-teams-to-solve-the-data-scientist-shortage/ .Hart, M. and Newby, G. (2013), “Project Gutenberg,” .Horton, N. J. (2015), “Challenges and opportunities for statistics and statistical education: lookingback, looking forward,” arXiv preprint arXiv:1503.02188 .Horton, N. J., Baumer, B. S., and Wickham, H. (2015), “Setting the stage for data science: integra-tion of data management skills in introductory and second courses in statistics,” arXiv preprintarXiv:1502.00318 . 12MDB.com (2013), “Internet Movie Database,” .James, G., Witten, D., Hastie, T., and Tibshirani, R. (2013), An introduction to statistical learning ,Springer, .Kandel, S., Heer, J., Plaisant, C., Kennedy, J., van Ham, F., Riche, N. H., Weaver, C., Lee, B.,Brodbeck, D., and Buono, P. (2011), “Research directions in data wrangling: Visualizations andtransformations for usable and credible data,”
Information Visualization , 10, 271–288, http://research.microsoft.com/EN-US/UM/REDMOND/GROUPS/cue/infovis/ .Linkins, J. (2013), “Let’s Calm Down About Twitter Being Able To Predict Elections, Guys,” .Lohr, S. (2009), “For Today’s Graduate, Just One Word: Statistics,” .Moore, D. S. (1998), “Statistics among the liberal arts,”
Journal of the American Statistical Asso-ciation , 93, 1253–1259, .Mosteller, F. and Wallace, D. L. (1963), “Inference in an authorship problem: A comparative studyof discrimination methods applied to the authorship of the disputed Federalist Papers,”
Journalof the American Statistical Association , 58, 275–309.Murrell, P. (2010),
Introduction to Data Technologies , Chapman and Hall/CRC, .Nolan, D. and Temple Lang, D. (2010), “Computing in the statistics curricula,”
The Amer-ican Statistician , 64, 97–107, .Rajaraman, A. and Ullman, J. D. (2011),
Mining of massive datasets , Cambridge University Press, .Rojas, F. (2013), “How Twitter can help predict an election,” .RStudio and Inc. (2013), shiny: Web Application Framework for R , r package version 0.8.0, http://CRAN.R-project.org/package=shiny .Stanton, J. (2012),
An Introduction to Data Science , https://ischool.syr.edu/media/documents/2012/3/DataScienceBook1_1.pdf .Swires-Hennessy, E. (2014), Presenting Data: How to Communicate Your Message Effectively , Wiley,1st ed., .Tan, P.-N., Steinbach, M., and Kumar, V. (2006),
Introduction to Data Mining , Pearson Addison-Wesley, 1st ed., .Tufte, E. R. (1983),
The Visual Display of Quantitative Information , Graphics Press, 2nd ed.Wickham, H. (2012), “my cynical definition: a data scientist is a statistician who is useful ;),” https://twitter.com/hadleywickham/status/263750846246969344 .— (2014), “Tidy data,”
The Journal of Statistical Software , 59, http://vita.had.co.nz/papers/tidy-data.html .Wickham, H. and Francois, R. (2014), dplyr: a grammar of data manipulation , R package version0.1, http://CRAN.R-project.org/package=dplyr .13ilkinson, L., Wills, D., Rope, D., Norton, A., and Dubbs, R. (2006),
The grammar of graphics ,Springer.Yau, N. (2011),
Visualize this: the Flowing Data guide to design, visualization, and statistics , WileyPublishing.— (2013),
Data points: visualization that means something , John Wiley & Sons.Zhu, Y., Hernandez, L. M., Mueller, P., Dong, Y., and Forman, M. R. (2013), “Data Acquisition andPreprocessing in Studies on Humans: What is Not Taught in Statistics Classes?”
The AmericanStatistician , 67, 235–241, http://dx.doi.org/10.1080/00031305.2013.842498 .14
Additional Topics
Spatial Analysis
At Smith, we have a Spatial Analysis Lab (SAL) staffed by a permamentdirector and a post-baccalaureate fellow. These two people were particularly interested in the datascience course, and attended most of the class meetings in the fall of 2013. We were able to build apartnership that brought the fascinating world of spatial analysis and GIS to MTH 292. Studentsfrom the class were encouraged to attend a series of workshops and lectures sponsored by the SALover the course of the semester.The groundwork for the importance and interest in data maps was laid in the visualization unitthrough discussion of John Snow’s cholera map, and other famous data maps presented by Tufte(1983) and Yau (2013). As the data manipulation unit winded to a close, an entire class periodwas devoted to spatial analysis and mapping. The SAL fellow delivered a lecture on the basics ofdata maps, providing examples and identifying key concepts in how data maps are created (e.g.normalization, projection systems, color scales, etc.). Next, we turned to how to work with spatialdata: what are shapefiles? Where can they be found on the Internet? How can they be used in R ?How do you draw a choropleth in R ? Finally, students were given some data from the admissionsoffice about the hometowns of Smith students, and asked to create a choropleth in R .Being familiar with only the basics of spatial analysis myself, I was astounded by the depth ofthe topic. Students also responded very positively to the prospect of creating colorful data maps.One student became so interested in working with ArcGIS that she began frequenting the SAL. Infuture incarnations of the course, one could consider extending this portion of the course into a fullmodule. Text Mining & Regular Expressions
Not all data is numerical, and since the purpose of thiscourse is to provide students with tools to work with a variety of data, one or two class periodswere devoted to working with text. There are many interesting questions that can be asked of datastored as text (Mosteller and Wallace, 1963), and many places to find such data. We focused onthe works of Shakespeare, which are conveniently available through Project Gutenberg (Hart andNewby, 2013). A simple question is: how many times does (the character) Macbeth speak in (theplay)
Macbeth ?The motivating challenge is that computers are highly efficient at storing text, but not very goodat understanding it, whereas humans are really good at understanding text, but not very good atstoring it. Thus, to answer our question, a human would have to scan the entire book and keep trackof how many times Macbeth spoke. Identifying when Macbeth speaks is easy, but scanning the bookis labor-intensive. It is also not a scalable solution (imagine having to do this for every character inthe book—or for all of Shakespeare’s plays instead of just one). Conversely, a computer can scanthe entire book in milliseconds, but needs to be instructed as to the pattern that indicates thatMacbeth is speaking. Pattern-matching through regular expressions , available in the UNIX shell orin R via the function grep() , provides an incredibly powerful mechanism for solving problems ofthis nature.While developing expertise with regular expressions is not likely to occur in just a few classperiods, a basic understanding is within the grasp of most students. This basic understanding isenough to give the student confidence that she could solve this type of problem in the future, ifgiven enough time and resources. Data Expo
Probably the most universally well-received aspect of the course was the Data Expo,which was held midway through the semester. At this point in the course, students were beginningto think about what they wanted to do for their term projects. With the idea of jump-starting theirthinking, five members of the community (faculty from Engineering, staff from SAL, InstitutionalResearch, and Administrative Technology, and a local data scientist working for a non-profit) cameto talk to the class about the data with which they work, the questions they would like to answerwith it, and the hurdles they currently face. The excitement in the room was palpable—one studenttold me afterwards that it was “awesome” and that “everyone is just so pumped right now to get15tarted on their projects.” Another student gushed about seeing the real-world applications of datascience.One of my goals for this course was to convince students that there are two major kinds of skillsone must have in order to be a successful data scientist: technical skills to actually do the analyses;and communication skills in order to present one’s findings to a presumably non-technical audience.There were several moments during the Data Expo when the guest speakers underscored those veryqualities, and expressed exasperation that so few people seemed to have both. For the instructor,this kind of third-party validation was invaluable at creating “buy-in” among students. Students,all but one of whom were juniors and seniors, seemed energized at the prospect that what they werelearning in class might translate directly into employable skills.
Network Science
During the last few weeks of class, students were hard at work on their projects(most of which were very demanding), and had limited bandwidth for absorbing new content. Thus,the final few class periods were devoted to special topics that were interesting, accessible, and fun,and would extend the main goals of the course.One of my own research fields is network science, which has both theoretical and applied aspects.Network science theory can be seen as an extension of the mathematical subject of graph theory,but applied to real-world networks in an attempt to form valid mathematical models for the net-works that we see in reality. For example, Google’s PageRank algorithm fits squarely into existingnotions of centrality in graphs developed by discrete mathematicians and computer scientists, butit’s application to the web and other real-world networks provokes interesting questions about thenature of communication networks in general.Students in MTH 292 were exposed to these ideas and a few others. For example, students wereasked to construct a “Kevin Bacon Oracle” that would find the shortest string of movies connectingtwo actors or actresses using data from the Internet Movie Database (IMDB (IMDB.com, 2013)).This requires understanding the network structure of Hollywood (i.e. actors/actresses are nodes,edges between nodes exist when both actors have appeared in a movie together), the notion ofshortest paths in graphs, the structure of the IMDB, including how to write SQL queries to retrievethe relevant information, and how to use a graph library in R (i.e. igraph ) to pull all of it together.Projects of this nature are emblematic of the diverse sources of knowledge that make data scienceinteresting. Big Data
MTH 292 is not a course on Big Data. Rather, it should be thought of as a precursorto Big Data (Horton et al., 2015), in that students leave data science with the experience of workingwith large data sets and knowledge of practical tools for doing so. The term “Big Data” is not sowell-defined—having both absolute and relative definitions that are popular. One relative definitionthat is relevant to most people—especially budding data scientists—is that “Big Data is when yourworkflow breaks.” Students in MTH 292 now understand why and when this type of difficulty arises,and have been given a series of tools to obviate that hurdle. However, they have not been exposed toBig Data in an absolute sense. On the last day of class, we discussed concepts that are most likelyassociated with absolute Big Data: parallel processing, non-SQL data storage schemes, Hadoop,and MapReduce. We reviewed the canonical MapReduce example of tabulating word frequency ina large number of documents, and ran Python and R code to do the computation.Certainly, this is not enough time to go in-depth with Big Data. But after having absorbed somuch over the past three months, and having had a chance to showcase their new skills throughtheir projects, students leave with a sense of satisfaction about what they have learned, but withtheir appetites whetted for the frontier that lies ahead. B Projects
These two abstracts summarize two of the more successful student projects in MTH 292: This definition of “big data” has been popularized by Randall Pruim. weathR : Twitter is an information product generated by its users. As a collection of recordsdirect from the horse’s mouth (or fingers, as it were), Tweets have a relationship with goings-on in users’ lives. We can use Tweets to examine the relationship between what users post—their perceptions of the world around them—and conditions in the world. For example, datascientists have been investigating whether or not we can predict governmental elections andstock market changes using Twitter. We examined this connection between social media postsand the external world through a facet of users’ lives that is accessible to us as data miners,universal and impactful: weather. • Smathies : For undergraduates, the prospect of applying to graduate programs can be adaunting process, made more difficult if that student lacks connections to the institutions inwhich they are interested. The knowledge of an existing connection currently or previouslyin a program - whether as an advisor or an alumni - can provide an undergraduate with avaluable stepping-stone towards making a final decision about said program.This project aims to explore the interconnectedness of Smith College alumnae, specificallythose who went on to earn a PhD in Mathematics or a related field. Our motivation for thisproject is to not only explore the connections that Smith alumnae make, but to also developa valuable tool for undergraduates searching for institutions or advisors with or without priorconnections to Smith. Specifically, the project explores connections between Smathies and theiradvisors, Smathies and their advisees, and Smathies and their co-authors with whom they havewritten academic papers. The connections allow us to see how far the Smathies world extendsbeyond Smathies themselves. We can explore whether or not Smathies have collaborated witha select group of co-authors, or if they prefer to seek out a variety of individuals. Additionally,we can see whether or not Smathies had preferred advisors.The point of this project, ultimately, is to explore both how connected Smathies are with therest of the Mathematics world and retrieve relevant information for current undergraduates.Two visual depictions of the Smathies network are shown in Figure 4. C Feedback
The following block quotations are excerpts from a Mid-Semester Assessment (MSA) conducted bythe Jacobson Center for Writing, Teaching and Learning at Smith College. An MSA Specialist meetswith students without the instructor being present, and solicits responses to specific questions. Thetext of the report is written by the MSA Specialist, but phrases in quotation marks are quotationsfrom actual students. Student responses are aggregated using a “all/most/many/some/one” scale.All students agree that they are learning useful things: “We are learning useful things–enough variety that even the most seasoned of us is still seeing new things...the examplesare cool...we’re learning a new, better way to think and ask questions...our projects teachus a way to tackle a problem.”To that end, the Data Expo was successful in helping students to appreciate the challenges peopleface when working with data.All students enjoy “Data Expo Day...the coolest!” and praise “the guest speakers for usto learn more about data science in the real world”; one group adds, “Thanks for thejob opportunities and letting us see what one can do in jobs and life with this.” This project received an Honorable Mention in the 2014 Undergraduate Statistics Class Project Competition(USCLAP). Math majors from Smith refer to themselves as Smathies.
D A Note to Prospective Instructors
Several people familiar with this course have asked about the skills required to teach this course.From my point-of-view the most important thing is to have the same willingness to learn new thingsthat you ask of your students. In terms of the content, a deep knowledge of all subjects is notrequired, although comfort and troubleshooting ability with R is necessary. Students are willing toaccept a certain amount of frustration that goes hand-in-hand with learning a new programminglanguage, but when they encounter roadblocks that seem immovable, that frustration can mutateinto helplessness. The instructor must provide enough support mechanisms to avoid this. Studentteaching assistants and office hours are especially helpful.Even without prior knowledge, enough of the material on data visualization and machine learningcan be absorbed in a relatively short period of time by reading a few of the books cited. SQL hasmany subtleties that are not likely to come up in this course, but the basics are not difficult to learn,even via online tutorials and self-study. Here again, some experience and practice are important.For students, prior programming experience is essential. Experience with R is not required, andin my experience, computer science majors with weaker statistical backgrounds usually fared betterthan students with stronger statistical backgrounds but less programming experience. This wasa demanding course that required most students to spend a substantial amount of time workingthrough assignments. However, even students who struggled were so convinced that what theywere learning was useful that there were few serious complaints. Nevertheless one could certainlyexperiment with slowing down the pace of the course.18 Sample Exam Questions
1. (20 pts) Suppose that we have two rectangular arrays of data, labeled students and houses .[In SQL terminology, students and houses are both table s. In R terminology, they are data.frame s.] students contains information about individual XXXXX students (e.g. herstudent id, name, date of birth, class year, campus house, etc.). Each row in students containsdata about one student. houses contains data about XXXXX houses (e.g. house name,capacity, street address, etc.). Each row in houses contains data about one XXXXX house.Suppose further that we want to generate a student address book. The address book willconsist of two columns of data: the first column will contain the student’s name; and thesecond will be the address where she lives.(a) Describe, in words , a data management operation that you could perform in order toachieve this. Be as specific as you can about what the operation will do and how it mustbe specified, but note that you do not have to write or reference SQL or R code!(b) It is important that every student appears in the address book, regardless of whether shelives on campus. Would a JOIN, LEFT JOIN, or RIGHT JOIN be most appropriate?Explain why.(c) Suppose now that only students from the Class of 2014 are to be included in the addressbook. What additional data management operation could you perform to achieve this?Again, be specific, but there is no need to write code.19. (10 pts) Briefly discuss the relative strengths of SQL vs. R . What does SQL do better than R ? What does R do better than SQL? [Hint: It may be helpful to give an example of a datascience task for which one or the other would be better suited.]20. (20 pts) You are working for the National Transportation Safety Board as a traffic engineer.One of your colleagues has written an R function that will simulate virtual traffic throughthe toll booth at the Holyoke/Springfield exit on the Massachusetts Turnpike. Given initialconditions based on the day of week and the temperature, the simulator will randomly generatetraffic, and record waiting times (in minutes) for individual cars at this toll booth. Thus, youmight use the function like this: simulate.traffic(dayofweek = "Thursday", temp = 48)simulate.traffic(dayofweek = "Thursday", temp = 48)