R

A Good Instrument is a Bad Control

Here’s a puzzle for you. What will happen if we regress some outcome of interest on both an endogenous regressor and a valid instrument for that regressor? I hadn’t thought about this question until 2018, when one of my undergraduate students asked it during class.

The R Formula Cheatsheet

R’s formula syntax is extremely powerful but can be confusing for beginners.1 This post is a quick reference covering all of the symbols that have a “special” meaning inside of an R formula: ~, +, .

From the Poisson Distribution to Stirling's Approximation

The Poisson distribution is the most famous probability model for counts, non-negative integer values. Many real-world phenomena are well approximated by this distribution, including the number of German bombs that landed in 1/4km grid squares in south London during WWII.

Three Ways of Thinking About Instrumental Variables

In this post we’ll examine a very simple instrumental variables model from three different perspectives: two familiar and one a bit more exotic. While all three yield the same solution in this particular model, they lead in different directions in more complicated examples.

Street Fighting Numerical Analysis - Part 1

Computing is a crucial part of modern applied and theoretical econometrics but most economists, myself included, have little if any formal training numerical analysis and computer science. This means that we often learn things the hard way: by making boneheaded mistakes and spending hours browsing stackoverflow to try to figure out what went wrong.

Thirty isn't the magic number

The simplest version of the central limit theorem (CLT) says that if \(X_1, \dots, X_n\) are iid random variables with mean \(\mu\) and finite variance \(\sigma^2\) \[ \frac{\bar{X}_n - \mu}{\sigma/\sqrt{n}} \rightarrow_d N(0,1) \] where \(\bar{X}_n = \frac{1}{n} \sum_{i=1}^n X_i\).

Past the Peak? Excess Deaths in England and Wales

Since my previous post, the Office for National Statistics has posted updated data on weekly deaths, and we’ve updated rcovidUK accordingly. Here’s where things stand: Figure 1: Total Weekly Deaths in England & Wales.

UK Excess Deaths by Age Group and Sex

In an earlier post I looked at regional differences in the effects of Covid-19 by calculating excess deaths in each week of 2020 relative to an average of the preceding five years.

Excess Deaths in England and Wales

To get a better idea of the impact of Covid19 in the UK, Dan Mead and put together an R package rcovidUK with weekly deaths in England and Wales, taken from the Office for National Statistics (ONS), allowing us to produce a plot of total deaths by region in 2020: Figure 1: Total Weekly Deaths in England & Wales.