# R

## Two Ways to fit Two-Way Fixed Effects in R

1. Introduction Recently, a friend asked me how to fit a two-way fixed effects model in R. A fixed effects model is a regression model in which the intercept of the model is allowed to move across individuals and groups. We most often see it in panel data contexts. Two-way fixed effects have seen massive interest from the methodological community. Some recent papers of interest are Imai and Kim 2019, Goodman-Bacon 2019, and Abraham and Sun 2018.

## Simulating Football Recruiting Evaluations with R

R is great for running quick simulations. Using a running example of college football recruit rankings, I show how we can leverage the power of R to see the implication of evaluators of different quality.

## OLS Estimation by "Hand" in R

A common programming assignment when learning regression is to calculate OLS estimators by hand. In this post, I show exactly how to program OLS estimation in R. In addition, I explain how to add different standard error calculations to replicate Huber-White standard errors and Stata robust standard errors.

## Learning R: Dealing Playcards

Introduction There are lots of benefits to learning a computer language, even if only learning enough to make yourself dangerous to your own computer. In this post, I’ll provide a purposely dumb way to shuffle playing cards and deal hands to different players. In doing so, I will demonstrate a variety of basic operations in the R language. # This is a comment. We write comments for future programmers # to be able to read and understand our code.

## Randomization Inference: A Simple Example

Randomization Inference is a non-parametric method for calculating p-values for hypothesis tests. This post provides a simple example to show how to do RI in R.

## Using pdftools to Extract Vote Data

Introduction Suppose you are a concerned citizen who would like to know how voters in a state voted. Perhaps you are a voter in a state with rampant corruption or perhaps you are a voter in a state that does not have paper backups for voting machines. Perhaps you are just masochistic enough to be interested in pulling tables out of reasonably well formed pdfs. The following is a code example for the last one.