View source: R/advanced-models.R
| qregress | R Documentation |
Fits one or several conditional quantile regression models using the optional quantreg package and R4VN model syntax.
qregress(y,
...,
vars = NULL,
data = NULL,
tau = 0.5,
method = "br",
se = "nid",
weights = NULL,
subset = NULL,
ref = NULL,
noconstant = FALSE,
diagnosis = FALSE,
level = 0.95,
digits = 3,
p_digits = 3,
show = TRUE,
console = FALSE)
y |
Outcome variable or formula. |
... |
R4VN predictor terms. |
vars |
Optional |
data |
Data frame or active data. |
tau |
One or more quantiles strictly between 0 and 1. |
method |
Algorithm passed to |
se |
Standard-error method passed to |
weights, subset, ref, noconstant |
Model controls consistent with other R4VN regression commands. |
diagnosis |
Logical; if |
level, digits, p_digits, show, console |
Confidence, formatting and display controls. |
The model nearest tau = 0.5 is stored as the primary active model; all requested quantile fits are retained in raw$models.
An R4VN result object, invisibly.
regress, nlregress
if (requireNamespace("quantreg", quietly = TRUE)) {
# Use a reasonably sized, full-rank data set so the example is stable
# across quantreg and R versions.
d <- datasets::mtcars
d$am <- factor(d$am, levels = c(0, 1),
labels = c("Automatic", "Manual"))
# Median regression with one continuous and one categorical predictor.
qregress(mpg, c.wt, i.am, data = d, tau = .5,
se = "iid", show = FALSE)
# Fit several conditional quantiles in one call.
qregress(mpg, c.wt, i.am, data = d,
tau = c(.25, .5, .75), se = "iid", show = FALSE)
# Request the R4VN quantile-regression diagnostic section.
qregress(mpg, c.wt, i.am, data = d, tau = .5,
se = "iid", diagnosis = TRUE, show = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.