Technical papers and textbooks demand complex estimation strategies that are often difficult to implement, even for scientists who are expert coders. The result is slow code copied and pasted from the internet, where the result is taken on faith.
estimatr provides a small set of commonly-used estimators (methods for estimating quantities of interest like treatment effects or regression parameters), written in
C++ for speed, and implemented in
R with simple, accessible syntax. We include two functions that implement means estimators,
horvitz_thompson(). In addition, we include two functions for linear regression estimators,
lm_lin(). In each case, scientists can choose an estimator to reflect cluster-randomized, block-randomized, and block-and-cluster-randomized designs.
Fast estimators also enable fast simulation of research designs to learn about their properties (see DeclareDesign).
This software is not yet ready for general release. Please contact the authors before using in experiments or published work. Specifications, names, and arguments of functions are subject to change.
If you would like to use the current development release of estimatr, please ensure that you are running version 3.3 or later of R and run the following code:
install.packages("estimatr", dependencies = TRUE, repos = c("http://R.declaredesign.org", "https://cloud.r-project.org"))
Once the package is installed, getting appropriate estimates and standard errors is now both fast and easy.
library(estimatr) # robust standard errors lm_robust(y ~ z, data = sample_dat) # cluster robust standard errors lm_robust(y ~ z, data = sample_dat, clusters = my_cluster_var) # blocked designs difference_in_means(y ~ z, data = sample_dat, blocks = my_block_var)
The Getting Started guide describes each estimator provided by estimatr and how it can be used in your analysis.
Getting estimates and robust standard errors is also faster than it used to be. Compare our package to using
lm() and the
sandwich package to get HC2 standard errors.