Description Usage Arguments Value Author(s) References See Also Examples
View source: R/rf.partial.prob.R
Produces partial dependency plots with probability distribution based on scaled margin distances.
1 2 3 4 |
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 |
(TRUE/FALSE) Plot results |
smooth |
c(spline, loess) Apply spline.smooth or loess to |
conf |
(TRUE/FALSE) Should confidence intervals be calculated for smoothing |
smooth.parm |
An appropriate smoothing parameter passed to loess or smooth.spline |
pts |
(FALSE/TRUE) Add raw points |
raw.line |
(FALSE/TRUE) Plot raw line (non-smoothed) |
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 |
A list class object with fit x,y. If smooth=c("spline","loess") y represents smoothed scaled margin distance values
Jeffrey S. Evans <jeffrey_evans<at>tnc.org>
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
smooth.spline
for smooth.spline details on spar smoothing argument
loess
for loess details of span smoothing argument
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | require(randomForest)
data(iris)
iris.rf <- randomForest(iris[,1:4], iris[,5])
# plot all parameters
par(mfrow=c(2,2))
for(i in names(iris)[1:4]) {
rf.partial.prob(iris.rf, iris, i, "setosa", smooth="spline",
n.pt=70, smooth.parm = 0.5)
}
# Plot spline and loess smoothing for one parameter, with raw points and line
par(mfrow=c(1,2))
rf.partial.prob(x = iris.rf, pred.data = iris, xname = "Sepal.Length",
which.class = "setosa", smooth = "spline", smooth.parm = 0.5,
n.pt = 70, pts = TRUE, raw.line = TRUE, rug = TRUE)
rf.partial.prob(x = iris.rf, pred.data = iris, xname = "Sepal.Length",
which.class = "setosa", smooth = "loess", smooth.parm = 0.20,
n.pt = 70, pts = TRUE, raw.line = TRUE, rug = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.