quantreg_spacing: Lower level function which calculates the quantile spacing...

View source: R/quant_regress.R

quantreg_spacingR Documentation

Lower level function which calculates the quantile spacing regression coefficients

Description

Lower level function which calculates the quantile spacing regression coefficients

Usage

quantreg_spacing(
  y,
  X,
  var_names,
  alpha,
  jstar,
  algorithm = "rq.fit.sfn",
  weights = NULL,
  control = list(small = 1e-06, trunc = TRUE, start_list = NA, output_quantiles =
    FALSE, calc_avg_me = FALSE, calc_r2 = T),
  ...
)

Arguments

y

Column of response variable.

X

Regression specification matrix.

var_names

RHS regression variable names.

alpha

Quantiles to be estimated.

jstar

First quantile to be estimated (usually the center one)

algorithm

The name of a function which will estimate a quantile regression. Defaults to rq.fit.sfn_start_val. Must be a string, as it is passed to do.call

weights

vector of optional weights

control

control parameters to pass to the control arguments of quantreg_spacing, the lower-level function called by qs. This is set via the function qs_control, which returns a named list, with 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.

  • 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

  • lambda: the penalization factor to be passed to penalized regression algorithms

...

other parameters passed to the algorithm

small

Minimum size of residuals for computational accuracy.

trunc

Boolean value; if true, replace those dependent values less than small with small itself; else, only use rows with residuals greater than small

start_list

Starting values for regression optimization.

Value

Returns a list of coefficients. num_betas is an x by p matrix of estimated parameters for each supplied quantiles. pseudo_r is a 1 by p matrix of psuedo R^2 values for each quantile estimate. warnings is a 1 by p matrix of warnings produced by each quantile regression call. iter: is a 1 by p matrix of iterations ran by each quantile regression call.


be-green/quantspace documentation built on March 20, 2024, 5:30 p.m.