Jens Hainmueller
Home ] Research ] [ Statistical Software ] [Videos] Courses ] CV ]


The ebal package implements entropy balancing (EB) as described in Hainmueller (2012). EB is a data preprocessing procedure that allows users to reweight a dataset. The preprocessing is based on a maximum entropy reweighting scheme that assigns weights to each data unit such that the covariate distributions in the reweighted data satisfy a set of moment conditions set by the researcher. This can be useful to balance covariate distributions in observational studies with a binary treatment where the control group data can be reweighted to match the covariate moments in the treatment group. Entropy balancing can also be used to reweight a survey sample to known characteristics from a target population. The weights that result from entropy balancing can be passed to any standard model to subsequently analyse the reweighted data. 

ebal is currently available for R and Stata as an alpha version. Feedback from users is appreciated.

Hainmueller and Yu (2013) is a paper that describes the Stata package.

ebal for R

You can obtain the ebal package for R from CRAN by typing:


ebalance for Stata

This package is written jointly with Yiqing Xu. Before installing the ebalance package for Stata, please make sure that your Stata is up to date (i.e. type update all on the Stata command prompt).

To install the ebal package for Stata type:
  ssc install ebalance , replace all