Why Doing Economics has embraced R

DE R graph
 
Thu 20th September 2018 | Blog

We’ve been delighted by the attention given to our Doing Economics practical projects for students, which we developed at the same time as Economy, Society and Public Policy, our text for non-specialists. You can use these projects alongside any of our material, but they are equally suitable for any course that teaches quantitative methods. Today we’re releasing Doing Economics projects 2 through 5 as projects that use R, an open-source programming language.

From today you can set projects using R on “Analysing data from experiments”, “Measuring the effect of a sugar tax”, “Measuring wellbeing”, and “Measuring inequality”. Project 1, on climate change, already exists in R, and at the end of October we will be completing the set with all the projects up to 12.

Ralf Becker at The University of Manchester was the driving force behind adding the R versions, based on his experience using R successfully to teach econometrics. His colleague James Lincoln, and Eileen Tipoe at CORE, helped to create them by adapting the Excel tasks.

Ralf and James have written R walk-throughs for almost every question. Besides teaching students how to do the specific task, they also explain the underlying coding techniques, making Doing Economics a good way to learn the basics of R.

All 12 of our Doing Economics projects exist in Excel format already, and of course this release doesn’t change our commitment to providing Excel versions. But adding R is intended to give you greater flexibility, depending on the aims of your course and the skills of the your students. As Ralf says in the video, there are only minor differences between the Excel and R versions, mostly where they were unavoidable due the the different capabilities of the software.

Not every student will initially have the motivation to learn a programming language. So why did we put so much effort in creating our projects in R?

That’s really two questions in one. First, why use a programming language to help introductory students learn quantitative methods? Second, why R, when academics have traditionally used packages such as SPSS or Stata?

Why use a programming language?

One of the reasons we were so enthusiastic to adopt R was the parallel commitment to it from the Q-Step Centres that the Nuffield Foundation, which has also funded the development of Doing Economics, have helped to establish. “We believe it’s a fantastic teaching tool for students at all levels, from undergraduates in introductory classes to advanced doctoral-level workshops” says Todd Hartman, Director of the Sheffield Q-Step Centre at the The University of Sheffield.

  • A programming language teaches creative problem-solving. “R encourages our students to think creatively because there are many different ways to accomplish the same task. And whatever they do is transparent and reproducible because the coding is there for anyone to see. We often use the analogy of thinking of R script files as recipes – at the end of the semester, they’ll have a cookbook of data analysis and statistical techniques. Our students support each other’s learning by sharing examples of what does and doesn’t work,” Hartman says.
  • Students can quickly make progress. “Once students learn the structure of the language and a few commonly used functions, they can produce some really sophisticated analyses and data visualisations,” he explains, “For instance, we ran a week-long summer school in quantitative methods for social science undergraduates, and in that short time they were able to import Brexit voting data from the web, merge it with other demographic indicators from the UK Census, clean and manipulate the data, run regression models to test their hypotheses, and create beautiful scatterplots fitted with loess curves to visualise key findings.”
  • Programming languages help students create (interactive) visualisations. A spreadsheet’s ability to create interactive applications is limited. But a package called Shiny used with R creates interactive web apps to work with data. For example, Hartman has introduced it successfully to level 2 social science students who had no previous programming experience.

Why R?

We believe that R is destined to become pervasive both in universities and beyond. With an estimated 2 million users, arguably it already is. R’s user base is flourishing for several reasons:

  • R is open source, and free. CORE has committed to making the materials we produce free and open-access online. Unlike its competitors, R is free to download. So there’s no software cost for students and teachers who want to use it, or just try it out before committing to it.
  • R is improving rapidly. The R user base grows 40% a year, and the user community cooperates to improve R continuously. A small group works on the R distribution, which offers all the basic functions. Users can also write and make available packages – blocks of R code to help complete specific tasks. There are now more than 13,000 packages in the official CRAN repository, and hundreds more available for free from other sources. Hartman says that “other software like Stata also has user-written package libraries, but our experience is that the cutting-edge methods often make their way to R before Stata.”
  • R has plenty of learning resources. Clearly a student’s ability to pick up R will vary. If they have no coding experience they might find Excel more intuitive at first (and need some help adjusting). There are now many free resources to help students learn R. Here’s a helpful list, but there are many more. DataCamp has a free introduction to R that almost 1 million users have signed up for. If you are familiar with other packages, there is also the challenge of adjusting to R, but it’s not so different.

“Ultimately, we adopted R because it has the most upside for our students – it gives them a powerful tool and is a strong signal to potential employers that they learned a difficult but valuable skill,” says Hartman, “we feel we’re preparing students for the foreseeable future.”

Note: Many teachers have been asking about support materials for ESPP. We have also posted teaching slides for Units 1 to 9 and exercise answers for Units 1 to 5 in the resources section, which are available to download if you have teacher access. More will follow soon.