qs.Rd
Compute quantile regressions via quantile spacings
qs(
formula,
data = NULL,
quantiles = c(0.9, 0.75, 0.5, 0.25, 0.1),
baseline_quantile = 0.5,
cluster_formula = NULL,
weights = NULL,
algorithm = "sfn",
control = qs_control(),
std_err_control = se_control(),
parallel = TRUE,
calc_se = TRUE,
seed = NULL,
...
)
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula)
vector of quantiles to be estimated
baseline quantile to measure spacings from (defaults to 0.5)
formula (e.g. ~X1 + X2) giving the clustering formula
optional vector of weights for weighted quantile regression
What algorithm to use for fitting underlying regressions. Either one of "sfn", "br", "lasso", "post_lasso", or a function name which estimates quantiles. See details.
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.
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
lambda
: the penalization factor to be passed to penalized regression algorithms
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 bootstrapRows
samples with replacement.`
whether to run bootstrap in parallel
boolean, whether or not to calculate standard errors
what seed to use for replicable RNG
additional arguments, ignored for now
The qs function is a higher-level interface to fitting quantile spacings model, handling both the quantile spacings regression, allowing the user to specify a number of possible algorithms and methods for standard errors. It also supports