# EconometricsWithR is a bookdown project you can run, not just read

> EconometricsWithR is the interactive companion to Stock and Watson's Introduction to Econometrics, published as a bookdown site with chapter R Markdown files, R scripts, datasets, DataCamp Light exercises and D3 based visualizations. It is a teaching scaffold pinned to one textbook and one set of data, and the patched stargazer package it depends on is the first thing to know about.

**mca91/EconometricsWithR** — 📖An interactive companion to the well-received textbook 'Introduction to Econometrics' by Stock & Watson (2015)

- Repository: https://github.com/mca91/EconometricsWithR
- Website: https://www.econometrics-with-r.org/
- Stars: 528 · Forks: 305
- Language: R
- License: NOASSERTION
- Published: 2026-10-22 · Updated: 2026-10-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/mca91-econometricswithr

## A companion for people who do not already know R

The premise is stated in the first paragraph of the README. Beginners with little background in statistics and econometrics often struggle to see the benefit of learning programming skills for econometrics, and Introduction to Econometrics with R is the answer to that: an interactive companion to the textbook Introduction to Econometrics by James H. Stock and Mark W. Watson, published in 2015.

The book gives a gentle introduction to the essentials of R programming and then walks students through the empirical applications presented in the textbook, so the code is not an extra exercise but the same analysis executed in front of the reader. The reference in the README is to the third update, global edition of the textbook from Pearson.

Two mechanisms carry that idea. Interactive programming exercises are generated with DataCamp Light, so a reader can type code into the page and get feedback without leaving the book. And central concepts are shown with interactive visualizations built on D3.js, the JavaScript library, which means a plot in the text can be something the reader moves rather than a static image.

The audience is therefore narrow and clear: an undergraduate or self-learner working through a specific econometrics textbook who wants the R side of the argument in front of them. It is a teaching aid, and reading it as a general econometrics course or as a research toolkit is a category error that the repository structure makes obvious once you look at the files.

## What is in the repository is a bookdown source tree

The root listing is a bookdown project, and it reads like one. The chapters are separate R Markdown files named for their chapter number, from 02-ch2.Rmd through 16-ch16.Rmd, alongside index.Rmd and references.Rmd. The bookdown configuration is in _bookdown.yml and _output.yml, and a shared setup script sits in _setup.R with a matching _setup.Rmd for anything that needs rendering.

Around that core are the assets a book needs. The js/ directory holds the JavaScript that drives the interactive graphics, d3.slider.css is the stylesheet for the D3 slider control, style.css and toc.css handle the general presentation, and fonts/ carries web fonts. The DCL/ directory holds the DataCamp Light exercise content, and data/ holds the datasets. References live in book.bib and packages.bib, with apa-old-doi-prefix.csl controlling citation formatting, and there are LaTeX artefacts in frontpage.tex and preamble.tex for people who want a printable version.

A few files show the seams of how the project is maintained. ITER.Rproj is the RStudio project, DESCRIPTION is present for tooling, build.sh is the build script, and .nojekyll marks the docs/ directory for GitHub Pages. ITER_cache/ and ITER_files/ are knitting by-products, which is the usual sign that the source tree is committed along with its build output.

The one file that is not a book artefact is stargazer/, a vendored copy of the stargazer package, plus stargazer_5.2.3.tar.gz next to it. That is the project's sharpest edge and it deserves its own section.

## Getting the materials with the itewrpkg metapackage

The companion is not installed as a package, because the book itself is a website. What you install is a metapackage, itewrpkg, that pulls in the R packages needed to reproduce the examples. The README calls it straightforward, and the instruction is to use install_github from devtools.

```r
# install `itewrpkg`
devtools::install_github("mca91/itewrpkg")
```

If devtools is not installed, the README says to run install.packages("devtools") first. The install also brings in the packages the book needs for its code examples, and running library(itewrpkg) attaches the package and its dependencies, which saves you attaching the packages introduced at the start of each chapter by hand. The README notes that this takes a few seconds and is convenient when you are working with code chunks from different chapters.

The downloads come from a function called get_materials_itewr(). It downloads up to date versions of the supplements, such as datasets and R code, from the repository and writes them into your working directory, or into the location you pass as the dir argument, in this structure.

```
- `<your_working_directory>/ITEWR/Rmds/` (.Rmd files)

- `<your_working_directory>/ITEWR/Data/` (datasets)

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

The R scripts are numbered by chapter, which is the detail that makes the folder useful, since you can run the analysis for the chapter you are reading and compare it with the book. The README's closing instruction here is to check your working directory with getwd() before you run it, which is advice worth following, since the download lands wherever you happen to be standing.

## The patched stargazer is the dependency to check first

The notes at the end of the README describe a modification to a widely used R package and explain why. The project is using a modified version of the stargazer package to compile LaTeX tables with long model names, because there is an issue with the CRAN version for R 4.2.0 and later. The modified package is published as a gist.

The consequence for an adopter is concrete. The LaTeX tables in the book, the ones that print regression output, depend on a patched package rather than the CRAN release. A student rendering the book locally with a current R installation hits that issue immediately, which is why the patched source is vendored in the repository as both a stargazer/ directory and a stargazer_5.2.3.tar.gz source archive.

If you take the book's code out of the book, say by copying a chapter's R scripts into your own project, you inherit that dependency. You now need the same patch, or you need to rewrite the table output, or you need to stay on an R version where the CRAN package behaves. The version number in the vendored tarball, 5.2.3, tells you which upstream release the patch was made against, and it also tells you that a later CRAN release could move the ground underneath you.

This is a good example of a general truth about companion repositories: the interesting difficulty is rarely the statistics, it is the chain of small version couplings that nobody writes down. The README is unusually honest about this one, which is the main reason it is worth reading before you start.

## Exercises and graphics depend on a hosted platform

The two interactive pieces are what make the companion a companion rather than a code dump, and both carry a dependency worth understanding.

The exercises are generated with DataCamp Light and live in the DCL/ directory. That means a reader's code is evaluated somewhere other than their own machine, in a service the project does not control. For a student on a good connection this is a feature, since there is nothing to install beyond the R packages the metapackage handles, and the feedback arrives immediately. For a reader on a locked down network, or in a classroom where the exercise platform is unavailable, the code chunks still work, but the interactive part of the page does not.

The visualizations are the second piece, and they are the more self-contained one. The js/ directory and the D3 slider stylesheet implement the interactive figures directly, so a rendered copy of the book carries its own graphics with no external service involved. The README credits D3.js as the flexible JavaScript library the visualizations are based on, and the split between DCL/ and js/ in the file listing reflects exactly that difference in dependency.

Taken together, the approach is coherent: run the statistics where the reader can see it, and keep the explanation in the page rather than in a console. The cost is that the book is a web artefact, and reproducing it faithfully means reproducing that environment rather than just running the R code.

## Licence, currency and the wrong-tool cases

Two constraints decide whether this repository is usable for your purposes, and they are not about R at all.

The first is the licence. The README states that the work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, and it displays the corresponding badge. The licence field on the repository itself is recorded as Other, a custom licence that GitHub cannot classify, with a LICENSE file in the root, so the README statement and the repository metadata are two different signals and the LICENSE file is what governs. The practical effect of the non-commercial term is that a company cannot use these files in a commercial training programme or an internal course without permission, and the share-alike term constrains redistribution of adapted versions. The underlying textbook is a separate copyright held by Pearson, so the permissions you have over the R code and the book are not the same thing.

The second is currency. The content tracks a 2015 textbook and its data, the last push to the repository was on 2026-04-04, and the project publishes no GitHub releases, so there is no version history to check and no release notes for a change in the R ecosystem. A researcher who wants current data or a maintained pipeline should not be looking here.

The wrong-tool cases follow from that. This is not a place to find econometrics methods, because the methods live in the textbook, and it is not a place to find production R code, because the code exists to be read alongside prose. A working analyst who already knows R and wants reproducible analysis on their own data is better served writing their own notebooks, keeping the textbook for the exposition and the datasets if they want to check a result. The companion's value is in the guided path with the exercises, and that value disappears once you no longer need the guidance.

## Conclusion

EconometricsWithR fits a student or instructor working through Stock and Watson who wants the code to run beside the text and the exercises to run in the browser. It does not fit an applied economist who needs current data, a reproducible pipeline or code cleared for commercial use, since the licence is non-commercial and the content tracks a 2015 edition. Before you build anything on it, confirm the patched stargazer works with your R version, since the README flags an issue with the CRAN version for R 4.2 and later. The last push was on 2026-04-04 and there are no GitHub releases.

## FAQ

### How do I download the EconometricsWithR code and data?

Install the itewrpkg metapackage with devtools::install_github("mca91/itewrpkg"), then call get_materials_itewr(). It downloads the current supplements from the repository into an ITEWR directory with Rmds, Data and Rcodes subfolders, where the R scripts are numbered by chapter.

### Do I need devtools to install the EconometricsWithR materials?

The README says to use install_github from the devtools package, and to run install.packages("devtools") if devtools is not installed. Running library(itewrpkg) afterwards loads the package and its dependencies so you do not have to attach the packages introduced at the start of each chapter.

### Why does EconometricsWithR ship its own stargazer package?

The README notes that the project uses a modified version of stargazer to compile LaTeX tables with long model names, because the CRAN version has an issue for R 4.2.0 and later. The patched source is vendored in the repository and is also published as a gist.

### What licence is EconometricsWithR under?

The README states that the work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The licence field on the repository is recorded as Other, a custom licence GitHub cannot classify, with a LICENSE file in the root that is the text to read.

### Is EconometricsWithR still being updated?

The repository is not archived and the last push was on 2026-04-04. There are no GitHub releases, and the content is tied to the 2015 third update global edition of Stock and Watson's textbook, with a modified stargazer package tracked against version 5.2.3.

## Sources

- [Issues](https://github.com/mca91/EconometricsWithR/issues)
- [mca91/EconometricsWithR on GitHub](https://github.com/mca91/EconometricsWithR)
- [Project website](https://www.econometrics-with-r.org/)
- [README](https://github.com/mca91/EconometricsWithR/blob/master/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/mca91-econometricswithr
