randomForest (version 4.0-7)

var.imp.plot: Variable Importance Plot

Description

Dotchart of variable importance as measured by a Random Forest

Usage

var.imp.plot(x, sort=TRUE, 
    n.var=min(30, if(is.null(dim(x$importance)))
            length(x$importance) else nrow(x$importance)),
    class=NULL,
    main=deparse(substitute(x)), ...)

Arguments

x
An object of class randomForest.
sort
Should the variables be sorted in decreasing order of importance?
n.var
How many variables to show? (Ignored if sort=FALSE.)
class
For classification data, an integer or string indicating the class for which variable importance is seeked.
main
plot title.
...
Other graphical parameters.

Value

  • Invisibly, the importance of the variables.

See Also

randomForest

Examples

Run this code
set.seed(4543)
data(mtcars)
mtcars.rf <- randomForest(mpg ~ ., data=mtcars, ntree=1000, keep=FALSE,
                          importance=TRUE)
var.imp.plot(mtcars.rf)

Run the code above in your browser using DataLab