create_balance_matrices {natstrat} | R Documentation |
Create matrix of balance constraints for linear program
Description
This creates the matrix of constraints that seek covariate balance for use in balance_LP()
which creates the linear program used by optimize_controls()
to choose which controls
to select.
Usage
create_balance_matrices(X, z, N, nvars, kc2, q_s, return = "all")
Arguments
X |
a matrix or data frame containing constraints in the columns. The number
of rows should equal the length of |
z |
a factor with the |
N |
the total number of available controls in the data. |
q_s |
a named vector or matrix indicating how many 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 |
return |
one of "all", "A", or "X", denoting whether all matrices should be returned, or just A or just the X matrix blocks. |
Value
A list containing up to three elements:
A
The matrix of covariate values and +/- 1s that are used as coefficients for the unit indicators and the epsilons in order to set the epsilons equal to the covariate imbalances.
x_blk
The covariate values used as coefficients for the unit indicators in the objective function.