Skip to content
Back to skills

Vip

ASecurity

R vip package for variable importance. Use for computing and visualizing variable importance scores.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill vip --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vip?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Vip
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-vip/badge)](https://www.skillsdirectory.com/skills/leolin990405-vip)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: vip
description: R vip package for variable importance. Use for computing and visualizing variable importance scores.
---

# vip

Variable Importance Plots.

## Basic Usage

```r
library(vip)

# Variable importance plot
vip(model)

# With options
vip(model, num_features = 10)
```

## Importance Methods

```r
# Model-specific (default)
vip(model, method = "model")

# Permutation-based
vip(model, method = "permute",
  train = train_data,
  target = "y",
  metric = "rmse")

# SHAP-based
vip(model, method = "shap",
  train = train_data)

# FIRM (feature importance ranking measure)
vip(model, method = "firm",
  train = train_data)
```

## Permutation Importance

```r
# Permutation importance
vi_perm <- vi_permute(
  model,
  train = train_data,
  target = "y",
  metric = "rmse",
  nsim = 10
)

# Plot
vip(vi_perm)
```

## SHAP Importance

```r
# SHAP-based importance
vi_shap <- vi_shap(
  model,
  train = train_data
)

vip(vi_shap)
```

## Custom Metrics

```r
# Custom loss function
my_metric <- function(actual, predicted) {
  mean(abs(actual - predicted))
}

vi_permute(model, train = train_data, target = "y",
  metric = my_metric)
```

## Partial Dependence

```r
# Partial dependence plots
library(pdp)

# Single variable
partial(model, pred.var = "age", train = train_data) %>%
  autoplot()

# Two variables
partial(model, pred.var = c("age", "income"), train = train_data) %>%
  autoplot()
```

## Extract Importance

```r
# Get importance values
vi(model)

# As data frame
vi_model(model)

# Sorted
vi(model) %>%
  arrange(desc(Importance))
```

## Plotting Options

```r
vip(model,
  num_features = 10,
  geom = "point",           # or "col", "boxplot"
  aesthetics = list(
    color = "steelblue",
    fill = "steelblue"
  ))

# Horizontal
vip(model, horizontal = TRUE)

# Include zero
vip(model, include_type = TRUE)
```

## Multiple Models

```r
# Compare models
vi1 <- vi(model1)
vi2 <- vi(model2)

# Combine and plot
library(ggplot2)
bind_rows(
  mutate(vi1, model = "Model 1"),
  mutate(vi2, model = "Model 2")
) %>%
  ggplot(aes(x = reorder(Variable, Importance), y = Importance, fill = model)) +
  geom_col(position = "dodge") +
  coord_flip()
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…