randomForest (version 3.4-1)

partial.plot: Partial dependence plot

Description

Partial dependence plot gives a graphical depiction of the marginal effect of a variable on the response, currently only implemented for random forests.

Usage

## S3 method for class 'randomForest':
partial.plot(x, pred.data, x.var, add=FALSE, n.pt=min(nrow(pred.data), 51),
             rug=TRUE, ...)

Arguments

x
an object of class randomForest, which contains a forest component.
pred.data
a data frame used for contructing the plot, usually the training data used to contruct the random forest.
x.var
(unquoted) name of the variable for which partial dependence is to be examined.
add
whether to add to existing plot (TRUE) or create a new plot (FALSE).
n.pt
if x.var is continuous, the number of points on the grid for evaluating partial dependence.
rug
whether to draw hash marks at the bottom of the plot indicating the deciles of x.var.
...
other graphical parameters to be passed on to plot or lines.

Value

  • A list with two components: x and y, which are the values used in the plot.

References

Freidman, J. (2001). Greedy function approximation: the gradient boosting machine, Ann. of Stat.

See Also

randomForest

Examples

Run this code
data(airquality)
airquality <- na.omit(airquality)
ozone.rf <- randomForest(Ozone ~ ., airquality)
partial.plot(ozone.rf, airquality, Temp)

Run the code above in your browser using DataLab