qreg_mrq: Multiple quantile regression, and quantile dressing, using...

View source: R/MQR_rq.R

qreg_mrqR Documentation

Multiple quantile regression, and quantile dressing, using linear quantile regression

Description

This function fits multiple conditional linear quantile regression models, optionally to the residuals of a user-specified deterministic forecast with facilities for cross-validation.

Usage

qreg_mrq(
  data,
  formula,
  quantiles = c(0.25, 0.5, 0.75),
  offset = NULL,
  cv_folds = NULL,
  exclude_train = NULL,
  sort = T,
  sort_limits = NULL,
  ...
)

Arguments

data

A data.frame containing target and explanatory variables. Optionally, supplying a deterministic forecast with offset will return the this forecast dressed with multiple predictive quantiles. May optionally contain a column called "kfold" with numbered/labelled folds and "Test" for test data.

quantiles

The quantiles to fit models for.

offset

The column name in data of an optional deterministic forecast to be dressed with multiple predictive quantiles.

cv_folds

Control for cross-validation with various options, either:

  • the column name of the fold index supplied in data. Observations and inputs in the index labelled "Test" will serve as test data and held out in model training.

  • an integer giving the number of cross validation folds to generate. Folds are constructed as block chunks. Default behaviour is 5 folds.

  • NULL indicates that no cross validation should be performed and the returned model is trained on all data.

exclude_train

A column name in data indicating if a row should be excluded from model training, i.e. if it contains bad data (will be coerced to logical). Alternatively, an integer or logical vector with length equal to the number of rows in data indicating the same. Rows labelled TRUE are excluded from model training.

sort

boolean Sort quantiles using SortQuantiles()?

sort_limits

Limits argument to be passed to SortQuantiles(). Constrains quantiles to upper and lower limits given by list(U=upperlim,L=lowerlim).

...

Additional arguments passed to rq.

formala

A formula object with the response on the left of an ~ operator, and the terms, separated by + operators, on the right passed to rq().

Details

The returned predictive quantiles are those produced out-of-sample for each cross-validation fold (using models trained on the remaining folds but not "Test" data). Predictive quantiles corresponding to "Test" data are produced using models trained on all non-test data.

Value

Returns a list containing predictive quantiles (in a MultiQR object) and rq models.

Author(s)

Jethro Browell, jethro.browell@glasgow.ac.uk


jbrowell/ProbCast documentation built on July 20, 2024, 1:53 p.m.