Learn R Programming

mobForest

mobForest R Package

mobForest implements random forest method for model based recursive partitioning. The mob() function, developed by Zeileis et al (2008), within party package, is modified to construct model-based decision trees based on random forests methodology. The main input function mobforest.analysis() takes all input parameters to construct trees, compute out-of-bag errors, predictions, and overall accuracy of forest. The algorithm performs parallel computation using clusterApply() function within the parallel package.

Installation

install.packages("mobForest")

Usage

To run the example, you will need the mlbench package. It contains a boston housing dataset for machine learning algorithms to run benchmark tests on.

library(mlbench)
set.seed(1111)
# Random Forest analysis of model based recursive partitioning load data
data("BostonHousing", package = "mlbench")
BostonHousing <- BostonHousing[1:90, c("rad", "tax", "crim", "medv", "lstat")] 

# Recursive partitioning based on linear regression model medv ~ lstat with 3 trees.  1 core/processor used. 
rfout <- mobforest.analysis(as.formula(medv ~ lstat), c("rad", "tax", "crim"),
mobforest_controls = mobforest.control(ntree = 3, mtry = 2, replace = TRUE,
        alpha = 0.05, bonferroni = TRUE, minsplit = 25), data = BostonHousing,
        processors = 1, model = linearModel, seed = 1111)
rfout

Copy Link

Version

Install

install.packages('mobForest')

Monthly Downloads

26

Version

1.3.1

License

GPL (>= 2)

Maintainer

Kasey Jones

Last Published

July 31st, 2019

Functions in mobForest (1.3.1)

compute.acc

Predictive accuracy estimates across trees for logistic regression model
compute.r2

Predictive accuracy estimates across trees for linear or poisson regression
compute.mse

Predictive accuracy estimates (MSE) across trees for linear or poisson regression model.
mob_fit_checksplit

Utility Function. Taken from party package to remove ":::" warning
mob_fit_childweights

Utility Function. Taken from party package to remove ":::" warning
mobforest.output

Model-based random forest object
mobforest.output-class

Class "mobforest.output" of mobforest model
residual.plot

Produces two plots: a) histogram of residuals, b) predicted Vs residuals. This feature is applicable only when linear regression is considered as the node model.
mobforest.control-class

Class "mobforest.control" of mobForest model
mobforest.control

Control parameters for random forest
string.formula

Model in the formula object converted to a character
get.pred.values

Get predictions summarized across trees for out-of-bag cases or all cases for cases from new test data
get.varimp

Variable importance scores computed through random forest analysis
prediction.output-class

Class "prediction.output" of mobForest model
mob_fit_splitnode

Utility Function. Taken from party package to remove ":::" warning
mobforest.analysis

Model-based random forest analysis
tree.predictions

Predictions from tree model
varimp.output

Variable importance matrix containing the decrease in predictive accuracy after permuting the variables across all trees
varimp.output-class

Class "varimp.output" of mobforest model
varimplot

A plot with variable importance score on X-axis and variable name on Y-axis.
prediction.output

Predictions and predictive accuracy estimates
mob_fit_fluctests

Utility Function. Taken from party package to remove ":::" warning
mob_fit_getlevels

Utility Function. Taken from party package to remove ":::" warning
print.estimates

Predictive Accuracy Report
predictive.acc

Predictive performance across all trees
get.mf.object.glm

Fit a general linear model to a mobForest model
get.mf.object.lm

Fit a linear model to a mobForest model
mob_fit_getobjfun

Utility Function. Taken from party package to remove ":::" warning
mob_fit_setupnode

Utility Function. Taken from party package to remove ":::" warning
logistic.acc

Contingency table: Predicted vs. Observed Outcomes
bootstrap

This method computes predicted outcome for each observation in the data frame using the tree model supplied as an input argument.
mob.rf.tree

Model based recursive partitioning - randomized subset of partition variables considered during each split.