plot.rfmstate_importance: Plot Feature Importance

View source: R/plot.R

plot.rfmstate_importanceR Documentation

Plot Feature Importance

Description

Visualizes per-transition feature importance as a grouped barplot or heatmap.

Usage

## S3 method for class 'rfmstate_importance'
plot(
  x,
  type = c("barplot", "heatmap"),
  col = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  ...
)

Arguments

x

An rfmstate_importance object.

type

Character, one of "barplot" (default), "heatmap".

col

Bar colors or heatmap gradient-anchor colors. NULL uses the package defaults.

main

Title.

xlab, ylab

Axis labels.

...

Additional graphical arguments. For a heatmap they are passed to image; for a barplot they are passed to barplot.

Value

The input x object, returned invisibly. Called for its side effect of producing a plot.

Limitations

Values are transition-specific ranger importance scores. Negative values may arise from Monte Carlo noise, sparse events, correlated predictors, or irrelevant variables and are not protective or causal effects. Scales may differ across transitions.

Examples

imp <- structure(list(
  importance_matrix = matrix(
    c(0.2, -0.1), nrow = 2,
    dimnames = list(c("x", "z"), "A->B")
  )
), class = "rfmstate_importance")
plot(imp, xlab = "OOB loss increase", ylab = "Predictor")


RFmstate documentation built on Sept. 10, 2026, 1:09 a.m.