vip

Variable importance plots (VIPs) for R: quantify and visualize which features drive a fitted model's predictions.

Installation

vip is no longer available on CRAN due to CRAN's stringent and ever-changing policies. It is now hosted on r-universe, which provides a reliable alternative for distributing R packages.

# Latest stable release (recommended)
install.packages("vip", repos = c("https://bgreenwell.r-universe.dev", "https://cloud.r-project.org"))

# Or with pak
pak::pak("bgreenwell/vip@main")  # latest stable release
pak::pak("bgreenwell/vip")       # development version (devel branch)

Migrating from vip 0.4.x

CRAN will archive the last CRAN release of vip (0.4.6) on 2026-07-13; all future releases live on r-universe (see above). vip 0.5.0 is also a breaking release — the main changes if you're coming from 0.4.x:

See NEWS.md for the complete list.

Quick start

library(vip)

# Simulate Friedman 1 benchmark data; only x1-x5 are important!
trn <- gen_friedman(500, seed = 101)  # ?vip::gen_friedman

# Model-specific importance from a random forest
library(ranger)
set.seed(101)
rfo <- ranger(y ~ ., data = trn, importance = "impurity")
vi(rfo)    # data frame of variable importance scores
vip(rfo)   # variable importance plot

# Permutation importance works for ANY model; just supply a prediction wrapper
pfun <- function(object, newdata) predict(object, data = newdata)$predictions
set.seed(102)
vis <- vi(rfo, method = "permute", train = trn, target = "y", metric = "rmse",
          pred_wrapper = pfun, nsim = 10)

# "vi" objects have a plot() method; additional arguments are passed on to
# tinyplot::tinyplot()
plot(vis, type = "boxplot", all_permutations = TRUE, jitter = TRUE,
     fill = "grey90")

vi() returns a tidy data frame of importance scores, so results are easy to post-process or plot with any graphics package.

Documentation

Development

Development happens on the devel branch (the repository default); main holds stable releases, which is what r-universe builds and the website documents. Please open pull requests against devel and report bugs via the issue tracker.