vimpPlot {bartMan}R Documentation

vimpPlot

Description

Plot the variable importance for a BART model with the 25 quantile.

Usage

vimpPlot(trees, type = "prop", plotType = "barplot", metric = "median")

Arguments

trees

A data frame created by 'extractTreeData' function.

type

What value to return. Either the raw count 'count' or the proportions 'prop' averaged over iterations.

plotType

Which type of plot to return. Either a barplot 'barplot' with the quantiles shown as a line, a point plot with the quantiles shown as a gradient 'point', or a letter-value plot 'lvp'.

metric

Whether to show the 'mean' or 'median' importance values. Note, this has no effect when using plotType = 'lvp'.

Value

A plot of variable importance.

Examples

if(requireNamespace("dbarts", quietly = TRUE)){
 # Load the dbarts package to access the bart function
 library(dbarts)
 # Get Data
 df <- na.omit(airquality)
 # Create Simple dbarts Model For Regression:
 set.seed(1701)
 dbartModel <- bart(df[2:6], df[, 1], ntree = 5, keeptrees = TRUE, nskip = 10, ndpost = 10)

 # Tree Data
 trees_data <- extractTreeData(model = dbartModel, data = df)
 vimpPlot(trees = trees_data, plotType = 'point')
}


[Package bartMan version 0.1.1 Index]