View source: R/preprocess_iqr_milp.R
preprocess_iqr_milp | R Documentation |
Fix the sign of outliers' residuals to solve the IQR MILP more quickly
preprocess_iqr_milp( Y, D, X, Z, Phi = linear_projection(D, X, Z), tau, M = NULL, TimeLimit = NULL, globalTimeLimit = Inf, prop_alpha_initial = 0.7, r = 1.25, show_iterations = FALSE, LogFileExt = ".log", ... )
Y |
Dependent variable (vector of length n) |
D |
Endogenous variable (n by p_D matrix) |
X |
Exogenous variable (including constant vector) (n by p_X 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 (number strictly between 0 and 1) |
M |
A large number that bounds the absolute value of the residuals (a positive number); defaults to 2 times the largest absolute residual from quantile regression of Y on X and D |
TimeLimit |
Maximum time (in seconds) spent on a linear program; defaults to heuristic (numeric) |
globalTimeLimit |
Maximum time (in seconds) spent on the entire
preprocessing function; defaults to Inf (i.e., no time limit) (numeric)
thus, 1 - |
prop_alpha_initial |
Initial value of the bandwidth alpha; |
r |
Rate at which we increase the bandwidth (alpha) at every iteration (number greater than 1) |
show_iterations |
If TRUE, print the iteration number to the console; defaults to FALSE (boolean) |
LogFileExt |
Extension of Gurobi log file; If |
... |
Arguments that will be passed to |
Obtain the residuals from a quantile regression of Y
on D
and
X
. Use these residuals to guide which ones are the outliers, and fix
their dual variables. In particular, fix the sign of the dual variables
associated with residuals whose magnitude is larger than the
α-percentile of the absolute residuals.
(Note that the initial value of α is given by
prop_alpha_initial
.)
Then, solve the preprocessed MILP.
If the minimized objective of the preprocessed MILP is not 0,
then too many dual variables have been fixed.
So, relax the number of fixed dual variables by multiplying the bandwidth
alpha by r
. Note that r
should be at least 1 to ensure
we are relaxing our preprocessing constraints. We then solve the relaxed
preprocessed MILP.
We repeatedly relax our preprocessing until the minimized objective is finally 0.
A named list of
final_fit: output of iqr_milp
from the final
iteration
time: time elapsed for this function to run
iteration: number of iterations before objective is 0
O_neg: indices for residuals that are fixed to be negative by the final iteration
O_pos: indices for residuals that are fixed to be positive by the final iteration
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.