iqr_milp: Compute inverse quantile regression estimator

View source: R/iqr_milp.R

iqr_milpR Documentation

Compute inverse quantile regression estimator

Description

Solve a mixed integer linear program to compute the inverse quantile regression estimator.

Usage

iqr_milp(
  Y,
  X,
  D,
  Z,
  Phi = linear_projection(D, X, Z),
  tau,
  O_neg = NULL,
  O_pos = NULL,
  M = NULL,
  TimeLimit = 300,
  VarHintVal_bool = FALSE,
  VarHintPri_bool = FALSE,
  BranchPriority_bool = FALSE,
  sparse = TRUE,
  attributes = list(),
  params = list(FeasibilityTol = 1e-06, LogToConsole = 0),
  start_method = NULL,
  start = NULL,
  fix = NULL,
  quietly = TRUE,
  show_progress = TRUE,
  LogFileName = "",
  LogFileExt = ".log"
)

Arguments

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 (number between 0 and 1)

O_neg, O_pos

Indices for residuals whose sign is fixed to be negative and positive, respectively (vectors)

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 300, will be appended to params

VarHintVal_bool

If TRUE, instead of fixing the binary variables as determined by O_neg,O_pos, we will "hint" these values; defaults to FALSE; see https://www.gurobi.com/documentation/9.1/refman/varhintval.html#attr:VarHintVal; overrides attributes

VarHintPri_bool

If TRUE, we specify the strength of the "hints" according to the magnitude of the residual from a naive QR; only valid if VarHintVal_bool is TRUE; overrides attributes; defaults to FALSE; see https://www.gurobi.com/documentation/9.1/refman/varhintpri.html#attr:VarHintPri

BranchPriority_bool

If TRUE, we specify which variables will be branched on first according to the magnitude of the residual from a naive QR; defaults to FALSE; see https://www.gurobi.com/documentation/9.1/refman/branchpriority.html

sparse

If TRUE (default), use sparse matrices

attributes

named list of Gurobi attributes, see https://www.gurobi.com/documentation/9.1/refman/attributes.html and https://www.gurobi.com/documentation/9.1/refman/the_model_argument.html; defaults to empty list

params

Gurobi parameters, see https://www.gurobi.com/documentation/9.1/refman/parameter_descriptions.html

start_method

Feed into compute_warmstart in the default value of start; defaults to NULL, ignored if start is not NULL

start

Gurobi attribute, see https://www.gurobi.com/documentation/9.1/examples/mip_starts.html; If NULL (default), no starting solution will be provided; see compute_warmstart

fix

Fix decision variables; If NULL (default), no starting solution will be provided; if NA, the respective decision variable won't be fixed; decision variables are:

  1. beta_X

  2. beta_Phi_plus

  3. beta_Phi_minus ; note: abs(beta_Phi) = beta_Phi_plus + beta_Phi_minus

  4. beta_D

  5. u

  6. v

  7. a

  8. k

  9. l

quietly

If TRUE (default), supress messages during execution (boolean)

show_progress

If TRUE (default), sends progress messages during execution (boolean)

LogFileName

Name of Gurobi log file; If string is empty (default), Gurobi log won't be saved (string)

LogFileExt

Extension of Gurobi log file; If LogFileName is empty, then Gurobi log won't be saved and this argument will be ignored; defaults to "log" (string)

Value

A named list of

  1. iqr: Gurobi model that was solved

  2. params: Gurobi parameters used

  3. result: solution to MILP returned by Gurobi

  4. status: status of Gurobi's solution

  5. beta_X: coefficients on exogenous variables

  6. beta_Phi_plus: positive part of coefficients on instruments

  7. beta_Phi_minus: negative part of coefficients on instruments

  8. beta_D: coefficients on endogenous variables

  9. u: positive part of residuals

  10. v: negative part of residuals

  11. a: dual variable

  12. k: binary variable associated with u

  13. l: binary variable associated with v

  14. beta_Phi: coefficients on instruments (beta_Phi_plus - beta_Phi_minus)

  15. resid: residuals (u - v)

  16. objval: value of objective function (absolute value of beta_Phi)


omkarakatta/ivqr documentation built on Aug. 20, 2022, 11:04 p.m.