Skip to contents

Thin extender over quantreg::rq for Koenker-Bassett quantile regression at one or more conditional quantiles (Koenker & Bassett, 1978; Koenker, 2005).

Usage

morie_quantile_reg(formula, tau = 0.5, data, ...)

Arguments

formula

A model formula of the form y ~ x1 + x2 + ....

tau

Numeric scalar or vector in (0, 1); the conditional quantile(s) at which to fit the regression (default 0.5, the median).

data

A data frame containing the variables in formula.

...

Further arguments forwarded to quantreg::rq (e.g. subset, weights, na.action, method, model, contrasts).

Value

A list with $method = "quantreg::rq" and $raw (an rq / rqs object with the fitted coefficients at each tau).

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("quantreg", quietly = TRUE)) {
    set.seed(1)
    n  <- 100
    df <- data.frame(x = stats::rnorm(n))
    df$y <- 1 + 2 * df$x + stats::rnorm(n)
    morie_quantile_reg(y ~ x, tau = c(0.25, 0.5, 0.75), data = df)
  }
} # }