viviBartPlot {bartMan}R Documentation

viviBartPlot

Description

Plots a Heatmap showing variable importance on the diagonal and variable interaction on the off-diagonal with uncertainty included.

Usage

viviBartPlot(
  matrix,
  intPal = NULL,
  impPal = NULL,
  intLims = NULL,
  impLims = NULL,
  uncIntLims = NULL,
  uncImpLims = NULL,
  unc_levels = 4,
  max_desat = 0.6,
  pow_desat = 0.2,
  max_light = 0.6,
  pow_light = 1,
  angle = 0,
  border = FALSE,
  label = NULL
)

Arguments

matrix

Matrices, such as that returned by viviBartMatrix, of values to be plotted.

intPal

A vector of colours to show interactions, for use with scale_fill_gradientn. Palette number has to be 2^x/2

impPal

A vector of colours to show importance, for use with scale_fill_gradientn. Palette number has to be 2^x/2

intLims

Specifies the fit range for the color map for interaction strength.

impLims

Specifies the fit range for the color map for importance.

uncIntLims

Specifies the fit range for the color map for interaction strength uncertainties.

uncImpLims

Specifies the fit range for the color map for importance uncertainties.

unc_levels

The number of uncertainty levels

max_desat

The maximum desaturation level.

pow_desat

The power of desaturation level.

max_light

The maximum light level.

pow_light

The power of light level.

angle

The angle to rotate the x-axis labels. Defaults to zero.

border

Logical. If TRUE then draw a black border around the diagonal elements.

label

legend label for the uncertainty measure.

Value

Either a heatmap, VSUP, or quantile heatmap plot.

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)

 # VSUP Matrix
 vsupMat <- viviBartMatrix(trees = trees_data,
                           type = 'vsup',
                           metric = 'propMean',
                           metricError = 'CV')
 # Plot
 viviBartPlot(vsupMat, label = 'CV')
 }



[Package bartMan version 0.1.1 Index]