Computes standard errors for the quantile regression spacing method using subsampling.

resample_qs(
  X,
  y,
  weights,
  sampling_method,
  alpha,
  jstar,
  control,
  algorithm,
  draw_weights,
  var_names,
  subsample_percent,
  cluster_index,
  ...
)

weighted_bootstrap(
  X,
  y,
  weights,
  sampling_method,
  alpha,
  jstar,
  control,
  algorithm,
  draw_weights,
  var_names,
  subsample_percent,
  cluster_index,
  ...
)

bootstrap(
  X,
  y,
  weights,
  sampling_method,
  alpha,
  jstar,
  control,
  algorithm,
  draw_weights,
  var_names,
  subsample_percent,
  cluster_index,
  ...
)

subsample(
  X,
  y,
  weights,
  sampling_method,
  alpha,
  jstar,
  control,
  algorithm,
  draw_weights,
  var_names,
  subsample_percent,
  cluster_index,
  ...
)

standard_errors(
  y,
  X,
  cluster_matrix,
  algorithm,
  control = qs_control(),
  std_err_control = se_control(),
  var_names,
  alpha,
  jstar,
  parallel = F,
  weights = NULL,
  seed = NULL,
  ...
)

Arguments

X

Regression specification matrix.

y

Column of response variable.

weights

vector of same length and order as dependent column, to be used as weights for estimation (note, if draw weights is set to TRUE, this variable will be the element-wise product of itself and a random vector of weights)

sampling_method

One of "leaveRows", "subsampleRows", or "bootstrapRows".

alpha

Quantiles to be estimated.

jstar

First quantile to be estimated (usually the center one)

control

control parameters to pass to the control arguments of quantreg_spacing, the lower-level function called by qs. This is a named list, with possible elements including:

  • trunc: whether to truncate residual values below the argument "small"

  • small: level of "small" values to guarentee numerical stability. If not specified, set dynamically based on the standard deviation of the outcome variable.

  • lambda: For penalized regression, you can specify a level of lambda which will weight the penalty. If not set, will be determined based on 10-fold cross-validation.

  • output_quantiles: whether to save fitted quantiles as part of the function output

  • calc_avg_me: whether to return average marginal effects as part of the fitted object

  • Any other arguments passed to specific downstream quantile regression algorithms (e.g. rq.fit).

algorithm

function which is actually used to fit each quantile regression

draw_weights

Whether to use random exponential weights for bootstrap, either TRUE or FALSE

var_names

RHS regression variable names.

subsample_percent

A number between 0 and one, specifying the percent of the data to subsample for standard error calculations

cluster_index

index for clusters to sample

...

other arguments passed to quantile fitting function

cluster_matrix

Matrix of cluster variables, as returned by a model formula

std_err_control

control parameters to pass to the control arguments of quantreg_spacing, the lower-level function called by standard_errors. Possible arguments include:

  • se_method: Method to use for standard errors, either "weighted_bootstrap", "subsample", "bootstrap" or "custom" along with a specified subsampling method and subsample percent. If specifying "custom", must also specify subsampling_percent and draw_weights. If you specify "subsample", subsampling percent defaults to 0.2, but can be changed. See details for details.

  • num_bs: Number of bootstrap iterations to use, defaults to 100.

  • subsample_percent: A number between 0 and one, specifying the percent of the data to subsample for standard error calculations

  • draw_weights: Whether to use random exponential weights for bootstrap, either TRUE or FALSE

  • sampling_method One of "leaveRows", "subsampleRows", or "bootstrapRows". leaveRows doesn't resample rows at all. subsampleRows samples without replacement given some percentage of the data (specified via subsample_percent), and boostrapRows samples with replacement.`

parallel

whether to run in parallel or not

seed

Seed to be used when generating RNG