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

viviNetwork

viviNetwork


Description

Create a Network plot displaying variable importance and variable interaction.

Usage

viviNetwork(
  mat,
  intThreshold = NULL,
  intLims = NULL,
  impLims = NULL,
  intPal = rev(colorspace::sequential_hcl(palette = "Blues 3", n = 100)),
  impPal = rev(colorspace::sequential_hcl(palette = "Reds 3", n = 100)),
  removeNode = FALSE,
  layout = igraph::layout_in_circle,
  cluster = NULL,
  nudge_x = 0.05,
  nudge_y = 0.03
)

Arguments

mat

A matrix, such as that returned by vivi, of values to be plotted.

intThreshold

Remove edges with weight below this value if provided.

intLims

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

impLims

Specifies the fit range for the color map for importance.

intPal

A vector of colours to show interactions, for use with scale_fill_gradientn.

impPal

A vector of colours to show importance, for use with scale_fill_gradientn.

removeNode

If TRUE, then removes nodes with no connecting edges when thresholding interaction values.

layout

igraph layout function or a numeric matrix with two columns, one row per node. Defaults to igraph::layout_as_circle

cluster

Either a vector of cluster memberships for nodes or an igraph clustering function.

nudge_x

Nudge (centered) labels by this amount, outward horizontally

nudge_y

Nudge (centered) labels by this amount, outward vertically

Value

A plot displaying interaction strength between variables on the edges and variable importance on the nodes.

Examples

library(ranger)
aq <- na.omit(airquality)
rF <- ranger(Ozone ~ ., data = aq, importance = "permutation")
myMat <- vivi(fit = rF, data = aq, response = "Ozone")
viviNetwork(myMat)

vivid

Variable Importance and Variable Interaction Displays

v0.1.0
GPL (>= 2)
Authors
Alan Inglis [aut, cre], Andrew Parnell [aut], Catherine Hurley [aut]
Initial release

We don't support your browser anymore

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