Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotImpVarDist

Plot Important Variable Distribution


Description

Plot distribution of predictor variables on classes sorted by order of importance in model.

Usage

plotImpVarDist(rf, df, class.col, max.vars = 16, plot = TRUE)

Arguments

rf

an object inheriting from randomForest.

df

data.frame with predictors in rf model.

class.col

response column name in df.

max.vars

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

plot

display the plot?

Value

the ggplot2 object is invisibly returned.

Note

If the model in rf was run with importance = TRUE, then 'MeanDecreaseAccuracy' is used as the importance measure. Otherwise, 'MeanDecreaseGini' is used.

Author(s)

Examples

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

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

rfPermute

Estimate Permutation p-Values for Random Forest Importance Metrics

v2.1.81
GPL (>= 2)
Authors
Eric Archer [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.