View source: R/make_quantile_reg.R
quantile_reg | R Documentation |
quantile_reg()
generates a quantile regression model specification for
the tidymodels framework. Currently, the
only supported engines are "rq", which uses quantreg::rq()
.
Quantile regression is also possible by combining parsnip::rand_forest()
with the grf
engine. See grf_quantiles.
quantile_reg(
mode = "regression",
engine = "rq",
quantile_levels = c(0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95),
method = "br"
)
mode |
A single character string for the type of model. The only possible value for this model is "regression". |
engine |
Character string naming the fitting function. Currently, only "rq" and "grf" are supported. |
quantile_levels |
A scalar or vector of values in (0, 1) to determine which quantiles to estimate (default is the set 0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95). |
method |
A fitting method used by |
fit.model_spec()
, set_engine()
library(quantreg)
tib <- data.frame(y = rnorm(100), x1 = rnorm(100), x2 = rnorm(100))
rq_spec <- quantile_reg(quantile_levels = c(.2, .8)) %>% set_engine("rq")
ff <- rq_spec %>% fit(y ~ ., data = tib)
predict(ff, new_data = tib)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.