This page explains the details of estimating weights using entropy balancing by setting method = "ebal" in the call to weightit() or weightitMSM(). This method can be used with binary, multinomial, and continuous treatments.

In general, this method relies on estimating weights by minimizing the negative entropy of the weights subject to exact moment balancing constraints. This method relies on code written for WeightIt using optim().

### Binary Treatments

For binary treatments, this method estimates the weights using optim() using formulas described by Hainmueller (2012). The following estimands are allowed: ATE, ATT, and ATC. When the ATE is requested, the optimization is run twice, once for each treatment group.

### Multinomial Treatments

For multinomial treatments, this method estimates the weights using optim(). The following estimands are allowed: ATE and ATT. When the ATE is requested, optim() is run once for each treatment group. When the ATT is requested, optim() is run once for each non-focal (i.e., control) group.

### Continuous Treatments

For continuous treatments, this method estimates the weights using optim() using formulas described by Tübbicke (2020).

### Longitudinal Treatments

For longitudinal treatments, the weights are the product of the weights estimated at each time point. This method is not guaranteed to yield exact balance at each time point. NOTE: the use of entropy balancing with longitudinal treatments has not been validated!

### Sampling Weights

Sampling weights are supported through s.weights in all scenarios.

### Missing Data

In the presence of missing data, the following value(s) for missing are allowed:

"ind" (default)

First, for each variable with missingness, a new missingness indicator variable is created which takes the value 1 if the original covariate is NA and 0 otherwise. The missingness indicators are added to the model formula as main effects. The missing values in the covariates are then replaced with 0s (this value is arbitrary and does not affect estimation). The weight estimation then proceeds with this new formula and set of covariates. The covariates output in the resulting weightit object will be the original covariates with the NAs.

moments and int are accepted. See weightit() for details.

base.weights

A vector of base weights, one for each unit. This works for continuous treatments as well. These correspond to the base weights $$q$$ in Hainmueller (2012). The estimated weights minimize the Kullback entropy divergence from the base weights, defined as $$\sum w \log(w/q)$$, subject to exact balance constraints. These can be used to supply previously estimated weights so that the newly estimated weights retain the some of the properties of the original weights while ensuring the balance constraints are met. Sampling weights should not be passed to base.weights but can be included in a weightit() call that includes s.weights.

d.moments

With continuous treatments, the number of moments of the treatment and covariate distributions that are constrained to be the same in the weighted sample as in the original sample. For example, setting d.moments = 3 ensures that the mean, variance, and skew of the treatment and covariates are the same in the weighted sample as in the unweighted sample. d.moments should be greater than or equal to moments and will be automatically set accordingly if not (or if not specified). Vegetabile et al. (2020) recommend setting d.moments = 3, even if moments is less than 3. This argument corresponds to the tuning parameters $$r$$ and $$s$$ in Vegetabile et al. (2020) (which here must be equal). Ignored for binary and multi-category treatments.

The arguments maxit and reltol can be supplied and are passed to the control argument of optim(). The "BFGS" method is used, so the defaults correspond to this.

The stabilize argument is ignored; in the past it would reduce the variability of the weights through an iterative process. If you want to minimize the variance of the weights subject to balance constraints, use method = "optweight".

obj

When include.obj = TRUE, the output of the call to optim(), which contains the dual variables and convergence information. For ATE fits or with multinomial treatments, a list of optim() outputs, one for each weighted group.

## Details

Entropy balancing involves the specification of an optimization problem, the solution to which is then used to compute the weights. The constraints of the primal optimization problem correspond to covariate balance on the means (for binary and multinomial treatments) or treatment-covariate covariances (for continuous treatments), positivity of the weights, and that the weights sum to a certain value. It turns out that the dual optimization problem is much easier to solve because it is over only as many variables as there are balance constraints rather than over the weights for each unit and it is unconstrained. Zhao and Percival (2017) found that entropy balancing for the ATT of a binary treatment actually involves the estimation of the coefficients of a logistic regression propensity score model but using a specialized loss function different from that optimized with maximum likelihood. Entropy balancing is doubly robust (for the ATT) in the sense that it is consistent either when the true propensity score model is a logistic regression of the treatment on the covariates or when the true outcome model for the control units is a linear regression of the outcome on the covariates, and it attains a semi-parametric efficiency bound when both are true. Entropy balancing will always yield exact mean balance on the included terms.

## References

Binary Treatments

Hainmueller, J. (2012). Entropy Balancing for Causal Effects: A Multivariate Reweighting Method to Produce Balanced Samples in Observational Studies. Political Analysis, 20(1), 25–46. doi:10.1093/pan/mpr025

Källberg, D., & Waernbaum, I. (2022). Large Sample Properties of Entropy Balancing Estimators of Average Causal Effects. ArXiv:2204.10623 [Stat]. https://arxiv.org/abs/2204.10623

Zhao, Q., & Percival, D. (2017). Entropy balancing is doubly robust. Journal of Causal Inference, 5(1). doi:10.1515/jci-2016-0010

Continuous Treatments

Tübbicke, S. (2022). Entropy Balancing for Continuous Treatments. Journal of Econometric Methods, 11(1), 71–89. doi:10.1515/jem-2021-0002

Vegetabile, B. G., Griffin, B. A., Coffman, D. L., Cefalu, M., Robbins, M. W., & McCaffrey, D. F. (2021). Nonparametric estimation of population average dose-response curves using entropy balancing weights for continuous exposures. Health Services and Outcomes Research Methodology, 21(1), 69–110. doi:10.1007/s10742-020-00236-2

weightit(), weightitMSM()

## Examples

library("cobalt")
data("lalonde", package = "cobalt")

#Balancing covariates between treatment groups (binary)
(W1 <- weightit(treat ~ age + educ + married +
nodegree + re74, data = lalonde,
method = "ebal", estimand = "ATT"))
#> A weightit object
#>  - method: "ebal" (entropy balancing)
#>  - number of obs.: 614
#>  - sampling weights: none
#>  - treatment: 2-category
#>  - estimand: ATT (focal: 1)
#>  - covariates: age, educ, married, nodegree, re74
summary(W1)
#>                  Summary of weights
#>
#> - Weight ranges:
#>
#>            Min                                  Max
#> treated 1.0000       ||                      1.0000
#> control 0.0398 |---------------------------| 5.2466
#>
#> - Units with 5 most extreme weights by group:
#>
#>               5      4      3      2      1
#>  treated      1      1      1      1      1
#>             589    595    269    409    296
#>  control 3.3964 3.4432 3.6553 4.0427 5.2466
#>
#> - Weight statistics:
#>
#>         Coef of Var   MAD Entropy # Zeros
#> treated       0.000 0.000   0.000       0
#> control       0.839 0.707   0.341       0
#>
#> - Effective Sample Sizes:
#>
#>            Control Treated
#> Unweighted   429.      185
#> Weighted     252.1     185
bal.tab(W1)
#> Call
#>  weightit(formula = treat ~ age + educ + married + nodegree +
#>     re74, data = lalonde, method = "ebal", estimand = "ATT")
#>
#> Balance Measures
#> age      Contin.   0.0000
#> educ     Contin.   0.0000
#> married   Binary   0.0001
#> nodegree  Binary   0.0000
#> re74     Contin.  -0.0000
#>
#> Effective sample sizes
#>            Control Treated

#Balancing covariates with respect to race (multinomial)
(W2 <- weightit(race ~ age + educ + married +
nodegree + re74, data = lalonde,
method = "ebal", estimand = "ATE"))
#> A weightit object
#>  - method: "ebal" (entropy balancing)
#>  - number of obs.: 614
#>  - sampling weights: none
#>  - treatment: 3-category (black, hispan, white)
#>  - estimand: ATE
#>  - covariates: age, educ, married, nodegree, re74
summary(W2)
#>                  Summary of weights
#>
#> - Weight ranges:
#>
#>           Min                                  Max
#> black  0.5530   |-------------------------| 5.3496
#> hispan 0.1409 |----------------|            3.3322
#> white  0.3979  |-------|                    1.9224
#>
#> - Units with 5 most extreme weights by group:
#>
#>            226    244    485    181    182
#>   black 2.5215 2.5491 2.8059 3.5551 5.3496
#>            392    564    269    345    371
#>  hispan 2.0467   2.53 2.6322 2.7049 3.3322
#>             68    457    599    589    531
#>   white 1.7106 1.7226 1.7426 1.7743 1.9224
#>
#> - Weight statistics:
#>
#>        Coef of Var   MAD Entropy # Zeros
#> black        0.590 0.413   0.131       0
#> hispan       0.609 0.440   0.163       0
#> white        0.371 0.306   0.068       0
#>
#> - Effective Sample Sizes:
#>
#>             black hispan  white
#> Unweighted 243.    72.   299.
#> Weighted   180.47  52.71 262.93
bal.tab(W2)
#> Call
#>  weightit(formula = race ~ age + educ + married + nodegree + re74,
#>     data = lalonde, method = "ebal", estimand = "ATE")
#>
#> Balance summary across all treatment pairs
#> age      Contin.       0.0001
#> educ     Contin.       0.0000
#> married   Binary       0.0001
#> nodegree  Binary       0.0001
#> re74     Contin.       0.0001
#>
#> Effective sample sizes
#>             black hispan  white

#Balancing covariates and squares with respect to
#re75 (continuous), maintaining 3 moments of the
#covariate and treatment distributions
(W3 <- weightit(re75 ~ age + educ + married +
nodegree + re74, data = lalonde,
method = "ebal", moments = 2,
d.moments = 3))
#> A weightit object
#>  - method: "ebal" (entropy balancing)
#>  - number of obs.: 614
#>  - sampling weights: none
#>  - treatment: continuous
#>  - covariates: age, educ, married, nodegree, re74
summary(W3)
#>                  Summary of weights
#>
#> - Weight ranges:
#>
#>        Min                                   Max
#> all 0.0001 |---------------------------| 17.6716
#>
#> - Units with 5 most extreme weights by group:
#>
#>         484   200    166     171     180
#>  all 6.7602 7.609 8.5222 10.2613 17.6716
#>
#> - Weight statistics:
#>
#>     Coef of Var   MAD Entropy # Zeros
#> all       1.254 0.615   0.424       0
#>
#> - Effective Sample Sizes:
#>
#>             Total
#> Unweighted 614.
#> Weighted   239.02
bal.tab(W3)
#> Call
#>  weightit(formula = re75 ~ age + educ + married + nodegree + re74,
#>     data = lalonde, method = "ebal", moments = 2, d.moments = 3)
#>
#> Balance Measures