plot.vimp.boostmtree: Plot Method for Variable Importance Objects

View source: R/plot.vimp.boostmtree.R

plot.vimp.boostmtreeR Documentation

Plot Method for Variable Importance Objects

Description

Plot variable-importance objects returned by vimp.boostmtree().

Usage

## S3 method for class 'vimp.boostmtree'
plot(
  x,
  show.interaction = TRUE,
  show.time.effect = TRUE,
  output = c("plot", "data", "pdf"),
  file = NULL,
  main = "Variable importance (%)",
  col = grey(0.80),
  cex.names = 0.8,
  eps = 0.1,
  ...
)

Arguments

x

An object of class vimp.boostmtree.

show.interaction

Logical value indicating whether time-interaction effects should be displayed when available.

show.time.effect

Logical value indicating whether the time-only effect should be reported in the plot margin when available.

output

One of "plot", "data", or "pdf". The default draws on the active graphics device.

file

File name used when output = "pdf".

main

Main title for the plot.

col

Bar color.

cex.names

Text magnification for variable names on the x-axis.

eps

Small amount added above the plotted range.

...

Additional arguments passed to barplot().

Details

The default behavior is to draw the variable-importance plot on the active graphics device.

For longitudinal fits, the plot shows main covariate effects above the x-axis and time-interaction effects below the x-axis. When available, the time-only effect is reported in the plot margin.

When output = "data", the function returns the plotting data instead of drawing anything. This can be useful if you want to customize the display.

Value

If output = "plot" or output = "pdf", the function returns the input object invisibly.

If output = "data", the function returns a list containing the plotting data for each response component.

Examples

set.seed(19)
sim.obj <- simLong(n = 15, n.time = 4, model = 1, family = "continuous")
dta <- sim.obj$data.list

fit <- boostmtree(
  x = dta$features,
  tm = dta$time,
  id = dta$id,
  y = dta$y,
  family = "continuous",
  M = 5,
  cv.flag = TRUE,
  verbose = FALSE,
  control = boostmtree.control(seed = 19)
)

vimp.obj <- vimp.boostmtree(fit, x.names = c("x1", "x2"))
plot(vimp.obj)

plot.data <- plot(vimp.obj, output = "data")
str(plot.data, max.level = 1)

boostmtree documentation built on April 10, 2026, 9:10 a.m.