Learn R Programming

rfUtilities (version 2.0-0)

rf.partial.prob: Random Forest probability scaled partial dependency plots

Description

Produces partial dependency plots with probability distribution based on scaled margin distances.

Usage

rf.partial.prob(x, pred.data, xname, which.class, w, prob = TRUE, plot = TRUE, smooth = FALSE, raw = FALSE, rug = FALSE, n.pt, xlab, ylab, main, ...)

Arguments

x
Object of class randomForest
pred.data
Training data.frame used for constructing the plot,
xname
Name of the variable for calculating partial dependence
which.class
The class to focus on
w
Weights to be used in averaging (if not supplied, mean is not weighted)
prob
Scale distances to probabilities
plot
Plot results (TRUE/FALSE)
smooth
Apply spline.smooth to y
raw
Plot unsmoothed values
rug
Draw hash marks on plot representing deciles of x
n.pt
Number of points on the grid for evaluating partial dependence.
xlab
x-axis plot label
ylab
y-axis plot label
main
Plot label for main
...
Additional graphical parameters passed to plot

Value

A list class object with fit x,y. If smooth=TRUE y represents smoothed scaled margin distance values

References

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

Baruch-Mordo, S., J.S. Evans, J. Severson, J. D. Naugle, J. Kiesecker, J. Maestas, & M.J. Falkowski (2013) Saving sage-grouse from the trees: A proactive solution to reducing a key threat to a candidate species Biological Conservation 167:233-241

Examples

Run this code
require(randomForest)
  data(iris)
    iris.rf <- randomForest(iris[,1:4], iris[,5])
      par(mfrow=c(2,2))
        for(i in names(iris)[1:4]) {     
          rf.partial.prob(iris.rf, iris, i, "setosa", smooth=TRUE, raw=TRUE, rug=FALSE)
         }

Run the code above in your browser using DataLab