This book is in Open Review. We want your feedback to make the book better for you and other students. You may annotate some text by selecting it with the cursor and then click the on the pop-up menu. You can also see the annotations of others: click the in the upper right hand corner of the page


Chair of Econometrics
Department of Business Administration and Economics
University of Duisburg-Essen
Essen, Germany

Last updated on Tuesday, October 30, 2018

Over the recent years, the statistical programming language R has become an integral part of the curricula of econometrics classes we teach at the University of Duisburg-Essen. We regularly found that a large share of the students, especially in our introductory undergraduate econometrics courses, have not been exposed to any programming language before and thus have difficulties to engage with learning R on their own. With little background in statistics and econometrics, it is natural for beginners to have a hard time understanding the benefits of having R skills for learning and applying econometrics. These particularly include the ability to conduct, document and communicate empirical studies and having the facilities to program simulation studies which is helpful for, e.g., comprehending and validating theorems which usually are not easily grasped by mere brooding over formulas. Being applied economists and econometricians, all of the latter are capabilities we value and wish to share with our students.

Instead of confronting students with pure coding exercises and complementary classic literature like the book by Venables & Smith (2010), we figured it would be better to provide interactive learning material that blends R code with the contents of the well-received textbook Introduction to Econometrics by J. Stock & Watson (2015) which serves as a basis for the lecture. This material is gathered in the present book Introduction to Econometrics with R, an empirical companion to J. Stock & Watson (2015). It is an interactive script in the style of a reproducible research report and enables students not only to learn how results of case studies can be replicated with R but also strengthens their ability in using the newly acquired skills in other empirical applications.

Conventions Used in this Book

  • Italic text indicates new terms, names, buttons and alike.

  • Constant width text is generally used in paragraphs to refer to R code. This includes commands, variables, functions, data types, databases and file names.

  • Constant width text on gray background indicates R code that can be typed literally by you. It may appear in paragraphs for better distinguishability among executable and non-executable code statements but it will mostly be encountered in shape of large blocks of R code. These blocks are referred to as code chunks.


We thank the Stifterverband für die Deutsche Wissenschaft e.V. and the Ministry of Science and Research North Rhine-Westphalia for their financial support. Also, we are grateful to Alexander Blasberg for proofreading and his effort in helping with programming the exercises. A special thanks goes to Achim Zeileis (University of Innsbruck) and Christian Kleiber (University of Basel) for their advice and constructive criticism. Another thanks goes to Rebecca Arnold from the Münster University of Applied Sciences for several suggestions regarding the website design and for providing us with her nice designs for the book cover, logos and icons. We are also indebted to all past students of our introductory econometrics courses at the University of Duisburg-Essen for their feedback.

Creative Commons License

This book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


Venables, W. N., & Smith, D. M. (2010). An Introduction to R. Retrieved from

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