Learn R Programming

⚠️There's a newer version (0.12.1) of this package.Take me there.

fixest: Fast and user-friendly fixed-effects estimation

The fixest package offers a family of functions to perform estimations with multiple fixed-effects in both an OLS and a GLM context. Please refer to the introduction for a walk-through.

At the time of writing of this page (February 2020), fixest is the fastest existing method to perform fixed-effects estimations, often by orders of magnitude. See below for a benchmarking with the fastest alternative software.

Benchmarking

Here is a comparison of the performance of fixest functions to other state of the art methods to perform estimations with multiple fixed-effects. The results are reported in the five figures below. Package fixest (black lines) is consistently faster in all situations.

Setup

The benchmarking was performed as follows: In the OLS context, we estimate the following equation:

The same functional form (one variable, three fixed-effects) is estimated for the Poisson, the Negative Binomial and the Logit cases (with ad hoc modifications to fit each model). See Berge (2018) for more details on the setup.

For the "difficult" benchmark (OLS only), the data is generated in a way that makes the convergence of the fixed-effects slow. The phenomenon of slow convergence is frequent for real micro-level data sets involving employee and firm fixed-effects for instance.

Each estimation is replicated 10 times and the average computing time is reported in the figures.

The alternative methods used for comparison are:

  • OLS: felm (R: package lfe), reghdfe (Stata) and FixedEffectModels (Julia)
  • Poisson: glmmboot (R: package glmmML), feglm (R: package alpaca) and ppmlhdfe (Stata)
  • Negative Binomial: glm.nb (R: package MASS) and nbreg (Stata)
  • Logit: glmmboot (R: package glmmML), feglm (R: package alpaca) and logit (Stata)

All the aforementioned packages were updated at the benchmarking date: February 2020.

The code and data for the benchmarking can be found in this folder.

Acknowledgements

Of course the development of fixest has been inspired and pushed forward by (almost all) these (great) packages used in the benchmarking and I am deeply indebted to their authors. Although fixest contains many features, some are still uncovered and you should definitely have a look at these packages.

Copy Link

Version

Install

install.packages('fixest')

Monthly Downloads

27,334

Version

0.8.3

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Laurent Berge

Last Published

March 1st, 2021

Functions in fixest (0.8.3)

BIC.fixest

Bayesian information criterion
coeftable

Obtain various statistics from an estimation
base_did

Sample data for difference in difference
as.list.fixest_multi

Transforms a fixest_multi object into a list
bread.fixest

Extracts the bread matrix from fixest objects
AIC.fixest

Aikake's an information criterion
aggregate.fixest

Aggregates the values of DiD coefficients a la Sun and Abraham
coefplot

Plots confidence intervals and point estimates
$.fixest_multi

Extracts the root of a fixest_multi object
coef.fixest

Extracts the coefficients from a fixest estimation
collinearity

Collinearity diagnostics for fixest objects
etable

Estimations table (export the results of multiples estimations to a DF or to Latex)
estfun.fixest

Extracts the scores from a fixest estimation
did_means

Treated and control sample descriptives
dof

Type of degree of freedom in fixest summary
deviance.fixest

Extracts the deviance of a fixest estimation
demean

Centers a set of variables around a set of factors
feNmlm

Fixed effects nonlinear maximum likelihood models
feglm

Fixed-effects GLM estimations
fixef_reexported

Functions exported from nlme to implement fixest methods
femlm

Fixed-effects maximum likelihood model
confint.fixest

Confidence interval for parameters estimated with fixest
fitted.fixest

Extracts fitted values from a fixest fit
fixef.fixest

Extract the Fixed-Effects from a fixest estimation.
formula.fixest

Extract the formula of a fixest fit
_index_

Fast and User-Friendly Fixed-Effects Estimations
feols

Fixed-effects OLS estimation
obs2remove

Finds observations to be removed from ML estimation with fixed-effects
nobs.fixest

Extracts the number of observations form a fixest object
hatvalues.fixest

Hat values for fixest objects
lag.formula

Lags a variable using a formula
print.fixest_fitstat

Print method for fit statistics of fixest estimations
print.fixest_multi

Print method for fixest_multi objects
f

Lags a variable in a fixest estimation
resid.fixest

Extracts residuals from a fixest object
sigma.fixest

Residual standard deviation of fixest estimations
setFixest_se

Sets the default type of standard errors to be used
fixest-deprecated

Deprecated functions in package fixest.
logLik.fixest

Extracts the log-likelihood
model.matrix.fixest

Design matrix of a femlm model
style.df

Style of data.frames created by etable
stepwise

Stepwise estimation tools
print.fixest

A print facility for fixest objects.
i

Create, or interact variables with, factors
predict.fixest

Predict method for fixest fits
[.fixest_multi

Subset a fixest_multi object
style.tex

Style definitions for Latex tables
setFixest_estimation

Default arguments for fixest estimations
setFixest_fml

Sets/gets formula macros
sandwich_reexported

Functions exported from sandwich to implement fixest methods
[.fixest_panel

Method to subselect from a fixest_panel
[[.fixest_multi

Extracts one element from a fixest_multi object
fitstat

Computes fit statistics of fixest objects
summary.fixest_multi

Summary for fixest_multi objects
summary.fixest.obs2remove

Summary method for fixest.obs2remove objects
fitstat_register

Register custom fit statistics
weights.fixest

Extracts the weights from a fixest object
terms.fixest

Extract the terms
wald

Wald test of nullity of coefficients
to_integer

Fast transform of any type of vector(s) into an integer vector
setFixest_coefplot

Sets the defaults of coefplot
trade

Trade data sample
unpanel

Dissolves a fixest panel
xpd

Expands formula macros
setFixest_dict

Sets/gets the dictionary relabeling the variables
panel

Constructs a fixest panel data base
plot.fixest.fixef

Displaying the most notable fixed-effects
rep.fixest

Replicates fixest objects
r2

R2s of fixest models
setFixest_notes

Sets/gets whether to display notes in fixest estimation functions
summary.fixest

Summary of a fixest object. Computes different types of standard errors.
summary.fixest.fixef

Summary method for fixed-effects coefficients
setFixest_nthreads

Sets/gets the number of threads to use in fixest functions
update.fixest

Updates a fixest estimation
vcov.fixest

Computes the variance/covariance of a fixest object