balance_LP {natstrat} | R Documentation |
Linear program that selects which controls to use in order to optimize balance
Description
This linear program is used by optimize_controls()
to choose which controls
to select.
Usage
balance_LP(
z,
X,
importances,
st,
st_vals,
S,
q_s,
N,
solver,
integer,
time_limit,
threads = 1,
weight_comp = 1
)
Arguments
z |
a factor with the |
X |
a matrix or data frame containing constraints in the columns. The number
of rows should equal the length of |
importances |
a vector with length equal to the number of constraints or columns
in |
st |
a stratum vector with the |
st_vals |
the unique stratum levels contained in |
S |
the number of unique stratum levels contained in |
q_s |
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 |
N |
the total number of available controls in the data. |
solver |
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. |
integer |
a logical stating whether to use a mixed integer programming solver
instead of randomized rounding. Default is |
time_limit |
numeric stating maximum amount of seconds for which the
program is allowed to run before aborting. Default is |
threads |
The maximum number of threads that should be used. This is only
applicable if |
Value
A list containing two elements:
lpdetails
The output of either
gurobi()
orRglpk_solve_LP()
, except that ifgurobi()
is used, the elementsobjval
andx
are renamedoptimum
andsolution
to be consistent with the output ofRglpk_solve_LP()
.o
The original output of either
gurobi()
orRglpk_solve_LP()
.