ebalance_custom | R Documentation |
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
)
Treatment |
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. |
X |
matrix of data where rows are observations and columns are covariates. |
base.weight |
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. |
norm.constant |
an optional numeric argument; users should leave unspecified in most cases. |
coefs |
an optional vector argument of length equal to one more than the number of covariates in |
max.iterations |
numeric maximum number of iterations to use when searching for weights |
constraint.tolerance |
numeric tolerance level. |
print.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. |
target.margins |
Column sums of |
co.xdata |
Covariate matrix for the controls only built from |
w |
weights found using ebalance. Note that treated units all receive flat weights of 1 |
maxdiff |
absolute value of the largest component of the gradient in the last iteration. |
norm.constant |
norm constant used |
constraint.tolerance |
tolerance used to evaluate convergence |
max.iterations |
max iterations used |
base.weight |
base weights used |
print.level |
print level used |
converged |
Convergence status. If ebalance failed to find weights within the specified |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.