.fit.quantile_rf | R Documentation |
tidyfit
Fits a nonlinear quantile regression forest on a 'tidyFit' R6
class. The function can be used with regress
.
## S3 method for class 'quantile_rf'
.fit(self, data = NULL)
self |
a 'tidyFit' R6 class. |
data |
a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). |
Hyperparameters:
ntree (number of trees)
mtry (number of variables randomly sampled at each split)
Important method arguments (passed to m
)
tau
(the quantile(s) to be estimated)
The function provides a wrapper for quantregForest::quantregForest
. See ?quantregForest
for more details.
The argument tau
is the chosen quantile (default tau = 0.5
).
tau
is passed directly to m('quantile_rf', tau = c(0.1, 0.5, 0.9)
and is not passed to predict
as in the quantregForest::quantregForest
package. This is done to ensure a consistent interface with the quantile regression from quantreg
.
Implementation
No implementation notes
A fitted 'tidyFit' class model.
Johann Pfitzinger
Meinshausen N (2017). quantregForest: Quantile Regression Forests. R package version 1.3-7, https://CRAN.R-project.org/package=quantregForest.
.fit.quantile
, .fit.rf
and m
methods
# Load data
data <- tidyfit::Factor_Industry_Returns
data <- dplyr::filter(data, Industry == "HiTec")
data <- dplyr::select(data, -Date, -Industry)
# Stand-alone function
fit <- m("quantile_rf", Return ~ ., data, tau = 0.5, ntree = 50)
fit
# Within 'regress' function
fit <- regress(data, Return ~ .,
m("quantile_rf", tau = c(0.1, 0.5, 0.9), ntree = 50))
explain(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.