This linear program is used by optimize_controls() to choose which controls
to select.
balance_LP(
z,
X,
importances,
st,
st_vals,
S,
q_s,
N,
solver,
integer,
time_limit,
threads = 1,
weight_comp = 1
)A list containing two elements:
lpdetailsThe output of either gurobi() or Rglpk_solve_LP(),
except that if gurobi() is used, the elements objval and x
are renamed optimum and solution
to be consistent with the output of Rglpk_solve_LP().
oThe original output of either gurobi() or Rglpk_solve_LP().
a factor with the ith entry equal to the treatment of unit i.
a matrix or data frame containing constraints in the columns. The number
of rows should equal the length of z. Balance is achieved when a constraint
sums to 0, such that numbers closer to 0 are better. When a constraint
does not apply to a particular unit, the entry should be NA.
This should typically be generated using generate_constraints().
a vector with length equal to the number of constraints or columns
in X. This can be generated using generate_constraints() and each nonnegative value
denotes how much to prioritize each constraint, with the default being 1
for all constraints.
a stratum vector with the ith entry equal to the
stratum of unit i. This should have the same order of units and length
as z.
the unique stratum levels contained in st.
the number of unique stratum levels contained in st.
a named vector or matrix indicating how many control units are to be selected from each stratum.
If there is one control group and all treated units are desired, this can be a vector; otherwise,
this should have one row per treatment group, where the order of the rows matches the order of
the levels of z, including the treated level.
the total number of available controls in the data.
a character stating which solver to use to run the linear program. Options are "Rglpk" (default) or "gurobi". You must have the 'gurobi' package installed to use the "gurobi" option. If available, this is the recommended solver.
a logical stating whether to use a mixed integer programming solver
instead of randomized rounding. Default is FALSE.
numeric stating maximum amount of seconds for which the
program is allowed to run before aborting. Default is Inf for no time limit.
The maximum number of threads that should be used. This is only
applicable if solver = 'gurobi'.