plot.permutation: Plot PLS permutation-test R2 and Q2 values

View source: R/main.R

plot.permutationR Documentation

Plot PLS permutation-test R2 and Q2 values

Description

Draws the permutation-test diagnostic plot produced by pls(..., perm.test = TRUE). The x-axis is the correlation between the original and permuted response structure; the y-axis is the observed or permuted R2/Q2 value. R2 is shown in blue and Q2 in red.

Usage

## S3 method for class 'permutation'
plot(
  x,
  ncomp = NULL,
  main = NULL,
  xlab = "Cor",
  ylab = "Value",
  col = c(R2 = "#3155B7", Q2 = "#E5332A"),
  pch = c(R2 = 16, Q2 = 15),
  legend_position = "bottomright",
  ...
)

Arguments

x

A fastPLS model fitted with perm.test = TRUE, or a permutation data frame stored in model$permutation.

ncomp

Component count to plot. Defaults to the largest component stored in the permutation table.

main, xlab, ylab

Plot title and axis labels.

col, pch

Colors and point symbols for R2 and Q2.

legend_position

Legend position passed to legend().

...

Additional graphical parameters passed to plot().

Value

Invisibly returns the plotted permutation data.

Examples

set.seed(1)
X <- as.matrix(iris[, seq_len(4)])
y <- iris$Sepal.Length
idx <- sample(seq_len(nrow(X)), 30)
fit <- pls(X[idx, ], y[idx], X[idx, ], y[idx],
    ncomp = 2, perm.test = TRUE, times = 5
)
plot.permutation(fit)

fastPLS documentation built on Sept. 29, 2026, 1:06 a.m.