Skip to content


Repository files navigation

📖 About the book

logo Beginners with little background in statistics and econometrics often have a hard time understanding the benefits of having programming skills for learning and applying Econometrics. Introduction to Econometrics with R is an interactive companion to the well-received textbook Introduction to Econometrics by James H. Stock and Mark W. Watson (2015). It gives a gentle introduction to the essentials of R programming and guides students in implementing the empirical applications presented throughout the textbook using the newly aquired skills. This is supported by interactive programming exercises generated with DataCamp Light and integration of interactive visualizations of central concepts which are based on the flexible JavaScript library D3.js.

The book can be found here: Introduction to Econometrics with R

📦 How to download materials using the itewrpkg R package

It is straightforward to download and install the itewrpkg metapackage for the companion using install_github() from the devtools package. Run install.packages("devtools") if you are not sure whether devtools is installed.

The following one-liner installs itewrpkg:

# install `itewrpkg`

Running the above command will also install all R packages which are required for reproducing the code examples presented throughout the book. Running library(itewrpkg) will load the package and all dependencies which makes it unnecessary to individually attach the packages introduced at the beginning of each chapter. This may take a few seconds but may be convenient if you are playing around with code chunks from various chapters.

The function get_materials_itewr() is intented as a convenience function for students working with the companion. It downloads up-to-date versions of all supplements to the book such as datasets and R codes from the GitHub repository of the book and saves them to the current working directory (or a location of choice provided to the argument dir) according to the following structure:

  • <your_working_directory>/ITEWR/Rmds/ (.Rmd files)

  • <your_working_directory>/ITEWR/Data/ (datasets)

  • <your_working_directory>/ITEWR/Rcodes/ (R scripts, numbered by chapter)

Make sure to check your working directory using getwd()!

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


Stock, J., & Watson, M. (2015). Introduction to Econometrics, Third Update, Global Edition. Pearson Education Limited.


We are currently using a modified version of the stargazer package to compile LaTeX tables with long model names (there is an issue with the CRAN version for R>=4.2.0). The package can be found here.