Why Should Economists Use R? A Peek at My Journey!
Updated: Jan 15
Economists perform statistical analyses for various reasons, including examining relationships between variables, forecasting future outcomes based on historical data, or evaluating economic policies. As such, economists need to master using statistical software to facilitate data analysis. In this blog, I will provide an overview of my journey with different statistical software as a student and later as an assistant professor of economics. I will explain why R has become my preferred software and why I believe that economists should use R.
Many of those who follow me online probably know that I did my undergraduate degree at a public university in Egypt before I completed my MSc and Ph.D. degrees in the United Kingdom. With a class size of a few thousand students, opportunities for receiving hands-on training are very limited in many Egyptian public universities. Unlike students these days, most Egyptian students of my generation, myself included, could not afford a personal computer. The only chance for me to use a computer was once a week during a university lab session. And as is the case with students embarking on learning how to handle data and conduct fundamental data analysis, Microsoft Excel was my first exposure to statistical software. Although the curriculum did not dive into sophisticated data analysis, it had a fair coverage of using different Excel functions. After finishing my undergraduate degree, I collaborated on an assignment with a friend who had some experience with SPSS, and I was able to pick up some of the basics from him. Yet, I do not claim that any of this was proper hands-on training on using statistical software.
I find it appropriate to say that I did not have serious training in using statistical software before my postgraduate studies in London. I then observed a striking contrast between the Egyptian and British educational systems. The curriculum was much shorter than in Egypt, but there was a greater emphasis on knowledge application, a missing element in the Egyptian education system. Egyptian students learn much more than their European peers but fall behind in applying this knowledge in different situations. During my MSc studies, I learned how to estimate several econometric models in Stata and EViews. I realized how crucial it is to write scripts for any codes used in the analysis and how this would allow replicating and editing my work later if needed. This step may seem insignificant to many readers, but it was a game-changer for me. I found writing code scripts in Stata much more straightforward than EViews, Stata then was my preferred software. It continued to be so until my second year in my Ph.D. studies when I realized that Stata's built-in functions and user-shared codes do not implement one of the econometric models I wanted to use in my thesis. I then started looking for alternatives which gave me good exposure to other software, including Matlab, Gauss, and Microfit. However, Stata continued to be my preferred software, and I only used other software occasionally when I had to.
After finishing my Ph.D., I worked as a faculty member at a British University, teaching econometrics using Stata and Eviews. I have to say that when working with time series models, students find Eviews much more accessible than Stata due to its simple menu-driven interface and comprehensive coverage of easy-to-estimate models. Still, I continued using Stata in my research for the same reason stated previously. I enjoyed writing loops that iterate through multiple tasks and produce a large amount of output in a short time that would otherwise take hours and days. I began writing Stata commands for tasks that I performed frequently or required customization. This approach has a steep learning curve and may take some time to prepare, but once your toolkit is ready, it saves you hours of work later, particularly when reproducing the results or recycling the same code into new projects. Then, I commenced research collaboration with a friend from an American university who is a proficient R user. I used to share my Stata codes with him, which he could utilize effectively. However, in certain instances, he found it easier to reproduce my Stata codes in R. I also observed from my friend’s work that R could easily generate elegant charts that I would not be able to produce using Stata or, at best, would take much more work to create. I decided to use R for our future projects, but I had no idea at the time that R would become my favourite statistical software.
For those unfamiliar with R, it is a programming language and software environment for statistical computing and data visualization. I believe economists should use R, and here is why.
Free: R is an open-source software, which means you can use it without any cost and access the source code if needed.
Customization: As a programming language, R allows you to write your code and customize your analyses to fit your specific needs.
Coverage: R has a wide range of tools and packages, including functions for data manipulation, statistical modelling, time series analysis, and data visualization allowing for performing various economic analyses, from simple regressions to complex simulations.
Reproducibility: R Markdown and the knitr package make it easy to create reproducible reports that combine code, results, and text in a single document.
Visualization: R provides functions to plot different charts, including scatter plots, bar plots, line plots, maps, and heatmaps, with a wide range of options for customizing the appearance and style of your charts. You have complete control of all chart elements and can easily combine your data analysis and visualization steps in a single workflow.
Community: R has a large and active community of users and developers who contribute to the development of R and its packages. You can access a wide range of resources and support for using R in your research.
Overall, statistical software can aid economists in analysing data, estimating econometric models, performing simulations, and effectively communicating their findings. As a result of my experience using various statistical software, I believe economists should utilize R as it offers a free, robust, and versatile tool for data analysis and visualization. Its powerful capability to integrate data manipulation, visualization and text, reproducibility features, and active community makes it a valuable option for economists.