Learn R Programming

rfPermute (version 2.5.2)

plotImpPreds: Plot Important Predictor Distribution

Description

For classification models, plot distribution of predictor variables on classes sorted by order of importance in model.

Usage

plotImpPreds(
  x,
  df,
  class.col,
  imp.type = NULL,
  max.vars = 16,
  scale = TRUE,
  size = 1,
  point.alpha = 0.2,
  violin.alpha = 0.5,
  plot = TRUE
)

Value

the ggplot2 object is invisibly returned.

Arguments

x

a rfPermute or randomForest model object.

df

data.frame with predictors in rf model.

class.col

response column name in df.

imp.type

character string representing importance type to use for sorting predictors.

max.vars

number of variables to plot (from most important to least).

scale

For permutation based importance measures, should they be divided their "standard errors"?

size, point.alpha, violin.alpha

controls size of points and alpha values (transparency) for points and violin plots.

plot

display the plot?

Author

Eric Archer eric.archer@noaa.gov

Examples

Run this code
library(randomForest)
data(mtcars)

df <- mtcars
df$am <- factor(df$am)

rf <- randomForest(am ~ ., df, importance = TRUE)
plotImpPreds(rf, df, "am")

Run the code above in your browser using DataLab