plot_stability: Plot Stability of Model Predictions

View source: R/plot_stability.R

plot_stabilityR Documentation

Plot Stability of Model Predictions

Description

Creates a visualization showing the variability of model predictions across multiple runs. This helps identify whether instability is uniform across the dataset or concentrated on specific observations.

Usage

plot_stability(predictions_matrix, type = c("range", "sd"), ...)

Arguments

predictions_matrix

A numeric matrix or data.frame where each row represents an observation and each column represents predictions from a single model run or resample.

type

Character string indicating what the error bars represent. Either "range" (default) or "sd" (standard deviation).

...

Additional arguments passed to plot.

Details

The plot displays the mean prediction for each observation with error bars representing the range (minimum and maximum) or standard deviation of predictions across runs.

Value

No return value, called for side effects (plotting).

Examples

# Simulate predictions from 5 model runs
set.seed(42)
base_predictions <- sort(rnorm(50))
predictions <- matrix(
    rep(base_predictions, 5) + rnorm(250, sd = 0.2),
    ncol = 5
)

plot_stability(predictions, main = "Model Prediction Stability")


TrustworthyMLR documentation built on Feb. 20, 2026, 5:09 p.m.