.fit.quantile_rf {tidyfit}R Documentation

Quantile regression forest for tidyfit

Description

Fits a nonlinear quantile regression forest on a 'tidyFit' R6 class. The function can be used with regress.

Usage

## S3 method for class 'quantile_rf'
.fit(self, data = NULL)

Arguments

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).

Details

Hyperparameters:

Important method arguments (passed to m)

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

Value

A fitted 'tidyFit' class model.

Author(s)

Johann Pfitzinger

References

Meinshausen N (2017). quantregForest: Quantile Regression Forests. R package version 1.3-7, https://CRAN.R-project.org/package=quantregForest.

See Also

.fit.quantile, .fit.rf and m methods

Examples

# 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)


[Package tidyfit version 0.7.1 Index]