View source: R/foc-center-archive.R
find_subsample_in_polytope | R Documentation |
It is useful to start our random walk at a subsample that is inside the FOC polytope. To find this polytope, we solve a linear program that aims to minimize the absolute L-1 norm of the weighted average of the xi_i objects. The weights are inside the unit interval and sum to the size of our subsample. Most of the weights will be integral, but some will be between 0 and 1. We will round the non-integral solutions so they are integra. If the weight for an observaion is 1, then that observation belongs in the subsample. Otherwise, the observation doesn't belong in the subsample. Due to the rounding, it isn't guaranteed that the resulting subsample belongs in the FOC polytope, but it shouldn't be too far away from the polytope. Note that this program excludes the observations in the active basis – we must add them back in after-the-fact.
find_subsample_in_polytope( h, Y, X, D, Z, Phi = linear_projection(D, X, Z), tau, beta_D_proposal = NULL, beta_X_proposal = NULL, subsample_size, params = list(OutputFlag = 0), type = "C" )
h |
Active basis in terms of the data provided |
Y |
Dependent variable (vector of length n) |
X |
Exogenous variable (including constant vector) (n by p_X matrix) |
D |
Endogenous variable (n by p_D matrix) |
Z |
Instrumental variable (n by p_Z matrix) |
Phi |
Transformation of X and Z to be used in the program; defaults to the linear projection of D on X and Z (matrix with n rows) |
tau |
Quantile (numeric) |
beta_D_proposal |
Coefficients on the endogeneous variables (vector of
length p_D); if NULL, use |
beta_X_proposal |
Coefficients on the exogeneous variables (vector of
length p_D); if NULL, use |
subsample_size |
Size of subsample |
params |
Named list of parameters to send to Gurobi |
type |
Either "C" or "B" to denote if our "omega" variables are continuous or binary; If "C", then the solution is the continuous center of our FOC polytope; If "B", then the solution is the actual center |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.