| Type: | Package |
| Title: | Regression-Enhanced Random Forests |
| Version: | 1.0.0 |
| Description: | A novel generalized Random Forest method, that can improve on RFs by borrowing the strength of penalized parametric regression. Based on Zhang et al. (2019) <doi:10.48550/arXiv.1904.10416>. |
| License: | MIT + file LICENSE |
| BugReports: | https://github.com/umbe1987/regenrf/issues |
| Imports: | glmnet, randomForest |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| URL: | https://github.com/umbe1987/regenrf |
| NeedsCompilation: | no |
| Packaged: | 2025-12-17 13:12:29 UTC; minorum |
| Author: | Umberto Minora |
| Maintainer: | Umberto Minora <umbertofilippo@tiscali.it> |
| Repository: | CRAN |
| Date/Publication: | 2025-12-22 18:00:08 UTC |
Regression-Enhanced Random Forests
Description
RegEnRF() implements Regression-Enhanced Random Forests algorithm (based on
Zhang et al., 2019 paper) for regression.
Usage
RegEnRF(x, y, lambda, ...)
Arguments
x |
A numeric matrix of predictors. Requirement: nvars >1;
in other words, x should have 2 or more columns. This is a constraint
of |
y |
A numeric response vector. |
lambda |
See 'lambda' argument in |
... |
other arguments passed to |
Details
This function is based on the packages randomForest::randomForest
and glmnet::glmnet.
Value
An object with S3 class "RegEnRF"
Author(s)
Umberto Minora umbertofilippo@tiscali.it, based on the paper by Zhang et al. (2019).
References
Zhang, H., Nettleton, D., & Zhu, Z. (2019). Regression-enhanced random forests. arXiv preprint doi:10.48550/arXiv.1904.10416.
Examples
set.seed(111)
data(co2)
x <- matrix(c(time(co2), cycle(co2)), ncol = 2)
y <- as.numeric(co2)
mod <- RegEnRF(x, y, lambda = 0.1)
freq <- frequency(co2)
startt <- tsp(co2)[2] + 1 / freq
xnew.t <- seq(startt, by = 1 / freq, length.out = freq * 3)
xnew <- matrix(c(xnew.t, cycle(tail(co2, freq * 3))), ncol = 2)
pred <- predict(mod, xnew)
pred.ts <- ts(pred, start = startt, frequency = freq)
plot(ts.union(co2, pred.ts), plot.type = "single", col = c("black", "red"))
Prediction of test data using Regression-Enhanced Random Forests.
Description
Prediction of test data using Regression-Enhanced Random Forests.
Usage
## S3 method for class 'RegEnRF'
predict(object, newx, ...)
Arguments
object |
an object of class "RegEnRF", as that created by the function RegEnRF |
newx |
matrix of new values for x at which predictions are to be made function will abort. |
... |
other arguments passed to glmnet::predict.glmnet and randomForest:::predict.randomForest. |
Value
A vector of predicted values.
Examples
set.seed(111)
x <- matrix(rnorm(100 * 20), 100, 20)
y <- rnorm(100)
mod <- RegEnRF(x, y, lambda = 0.1)
predict(mod, newx = x)