lfe2fixest

Installation

Install the package directly from GitHub:

# install.packages("remotes")
remotes::install_github("grantmcdermott/lfe2fixest")

Motivation

The goal of lfe2fixest is to take R scripts that rely on the felm() function from the lfe package and convert them to their feols() equivalents from the fixest package.

Why would you want to do this?

Both lfe::felm() and fixest::feols() provide “fixed-effects” estimation routines for high-dimensional data. Both methods are also highly optimised. However, feols() is newer, tends to be significantly faster, and allows for a lot more functionality (e.g. a predict method). At the same time, the primary author of lfe has stopped developing the package. It has since been adopted, but is now essentially in pure maintenance mode.

The syntax between felm() and feols() is similar, albeit with one not necessarily providing a drop-in replacement for the other. For example, the following two lines of code are functionally equivalent versions of the same underlying model.1

The lfe2fixest package automates the translation between these kinds of models. It does its best to ignoring any non-relevant arguments and adjust for differing syntax options between felm() and feols(). The end goal is a converted R script that will produce exactly the same output, some minor caveats notwithstanding.

Example

A detailed example is provided in the introductory vignette. See vignette("lfe2fixest").

Caveats

While I’m confident that lfe2fixest will work out-of-the-box in most (9 out of 10?) situations, there are some minor caveats to bear in mind.

1 An IV regression with multiple endogenous variables and fixed effects, as well as clustered standard errors. But that’s besides the point.