Learn R Programming

rfUtilities (version 1.0-2)

rf.crossValidation: Random Forest Classification Model Cross-validation

Description

Implements an n-Fold Cross-validation for Random Forests classification models

Usage

rf.crossValidation(x, xdata, p = 0.1, n = 99, seed = NULL, plot = TRUE,
  ...)

Arguments

x
random forest object
xdata
x data used in model
p
Percent data withhold
n
Number of cross validations
seed
Sets random seed in R global environment
plot
plot cross-validation error statistic (TRUE/FALSE)
...
Additional arguments passed to Random Forests

Value

  • A list class object with the following components: cv.Summary - Dataframe with summary statistics for error, pcc and ob Error.distribution - Vector of error values for each cv PCC.distribution - Vector of pcc values for each cv OOB.distribution - Vector of oob values for each cv

References

Evans, J.S. and S.A. Cushman (2009) Gradient Modeling of Conifer Species Using Random Forest. Landscape Ecology 5:673-683. Murphy M.A., J.S. Evans, and A.S. Storfer (2010) Quantify Bufo boreas connectivity in Yellowstone National Park with landscape genetics. Ecology 91:252-261 Evans J.S., M.A. Murphy, Z.A. Holden, S.A. Cushman (2011). Modeling species distribution and change using Random Forests CH.8 in Predictive Modeling in Landscape Ecology eds Drew, CA, Huettmann F, Wiersma Y. Springer

Examples

Run this code
require(randomForest)
  data(iris)
    iris$Species <- as.factor(iris$Species)
      set.seed(1234)
( rf.mdl <- randomForest(iris[,1:4], iris[,"Species"], ntree=501) )
  ( rf.cv <- rf.crossValidation(rf.mdl, iris[,1:4], p=0.10, n=99, ntree=501) )

Run the code above in your browser using DataLab