R for econometrics

Learn econometrics by actually doing it in R

A free, hands-on companion to your econometrics course. Every topic comes with runnable R code, real data and plots you can reproduce line by line. The focus is less on the math behind the methods and more on getting them to work.

Start with the basics Browse all topics

51 articles · free and without registration · every example runs on your own machine

New here? Three steps to your first regression

  1. 1

    Set up R and RStudio

    Install both, learn what the four panes are for and how to keep a workspace tidy.

    Install R
  2. 2

    Get data into shape

    Import data sets, reshape them with dplyr and plot what you find with ggplot2.

    Wrangle data
  3. 3

    Run your first regression

    Estimate an OLS model, read the summary output and test whether it holds up.

    Estimate OLS

Introduction to R — the short version

An under-30-page introduction that walks through one realistic workflow and the packages dplyr, ggplot2 and openxlsx. Free PDF, no sign-up.

Download the PDF

From the blog All posts →

About this site

r-econometrics is written and maintained by Franz X. Mohr. It grew out of the notes taken while learning to use the free statistical software R for econometric work, and it is meant to give you an intuition for the structure of the program and for the statistical functions needed to pass an introductory or intermediate course in econometrics.

It is not a replacement for a good textbook. The math behind the methods is kept short on purpose, so that you can get to a working example quickly and then look up the theory wherever your course expects you to. Everything here is free to read, and the code on every page can be copied straight into your own R session.

About and disclaimer Further resources