This is a custom version of the ebal
(entropy balancing) package by Jens Hainmueller. Chooses weights on controls to make
covariate means equal to those of treated. This version differs from ebal
only in that it handles
cases where there is only a single unit, which otherwise causes a problem in the original code.
ebalance_custom(
Treatment,
X,
base.weight = NULL,
norm.constant = NULL,
coefs = NULL,
max.iterations = 200,
constraint.tolerance = 0.001,
print.level = 0
)
Column sums of X
among the treated units.
Covariate matrix for the controls only built from X
with an additional appended column of ones.
weights found using ebalance. Note that treated units all receive flat weights of 1
absolute value of the largest component of the gradient in the last iteration.
norm constant used
tolerance used to evaluate convergence
max iterations used
base weights used
print level used
Convergence status. If ebalance failed to find weights within the specified constraint.tolerance
after max.iterations
this is FALSE
. Note that even if ebalance does not converge, the last iteration's weights w
are returned.
a numeric vector of length equal to the total number of units where treated (population) units take a value of 1 and control (sampled) units take a value of 0.
matrix of data where rows are observations and columns are covariates.
an optional numeric vector argument of length equal to the total number of control units to specify the base weight of each control unit within entropy balancing. Default is even weights (1) for all controls.
an optional numeric argument; users should leave unspecified in most cases.
an optional vector argument of length equal to one more than the number of covariates in X
; users should leave unspecified in most cases.
numeric maximum number of iterations to use when searching for weights
numeric tolerance level.
a numeric argument to specify the amount of information printed out. 0 is silent, 1 prints convergence status, 2 prints maximum deviance per iteration, 3 prints loss and step length.