plot_prediction: Prediction Swimmer Plot for orthoMTL

View source: R/plot.R

plot_predictionR Documentation

Prediction Swimmer Plot for orthoMTL

Description

Displays a prediction matrix as a heatmap (swimmer plot), where rows are patients and columns are tasks/thresholds.

Usage

plot_prediction(x)

Arguments

x

A numeric prediction matrix with dimensions n x numTasks, typically produced by predict.orthoMTL.

Value

A ggplot2 object.

See Also

predict.orthoMTL

Examples

set.seed(42)
n <- 50; p <- 10; n_tasks <- 3
X <- matrix(rnorm(n * p), n, p)
colnames(X) <- paste0("V", seq_len(p))
Y <- X %*% matrix(rnorm(p * n_tasks), p) + matrix(rnorm(n * n_tasks), n) * 0.1
colnames(Y) <- c("T1", "T2", "T3")
K <- matrix(1, n_tasks, n_tasks); diag(K) <- 0.5
fit <- orthoMTL(X, Y, lambda = 1e-3, K = K)

preds <- predict(fit, newdata = X)
plot_prediction(preds)

orthoMTL documentation built on Aug. 23, 2026, 5:10 p.m.