viviBartPlot function

viviBartPlot

viviBartPlot

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

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.

Returns

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') }
  • Maintainer: Alan Inglis
  • License: GPL (>= 2)
  • Last published: 2024-07-24

Useful links