View source: R/grmforest-varimp-plot.R
| plot.varimp | R Documentation |
Creates a bar plot of variable importance scores with options for both ggplot2 and base R graphics.
## S3 method for class 'varimp'
plot(x, top_n = NULL, use_ggplot = TRUE, ...)
x |
A |
top_n |
Number of top variables to display (NULL for all). |
use_ggplot |
Logical indicating whether to use ggplot2 (if available). |
... |
Additional arguments passed to plotting functions. |
Invisibly returns the input object.
varimp calculates the variable importance for GRM
Forest, grmforest for GRM Forests,
grmforest.control creates a control object for grmforest,
plot.grmtree creates plot for the grmtree object
library(grmtree)
library(hlt)
data("asti", package = "hlt")
asti$resp <- data.matrix(asti[, 1:4])
# Fit forest with default parameters
forest <- grmforest(resp ~ gender + group, data = asti)
imp <- varimp(forest)
plot(imp)
plot(imp, top_n = 1) ## select top 1 importance variable
plot(imp, use_ggplot = FALSE) # Use base R graphics
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.