autoplot.suggest_k: Plot a suggest_k diagnostic

View source: R/suggest_k.R

autoplot.suggest_kR Documentation

Plot a suggest_k diagnostic

Description

Renders a ggplot2 diagnostic for a suggest_k object. The plot shows one panel for each criterion group that was requested: Scree/PA (if "pa_pc" or "pa_fa" were requested), MAP (if "map"), VSS (if "vss"), and CD RMSE (if "cd" and EFAtools was available). When four panels are shown the layout is a 2x2 grid; otherwise a single-column layout is used. The recommended k for each criterion is marked with a star-shaped point.

Usage

## S3 method for class 'suggest_k'
autoplot(object, ...)

Arguments

object

A suggest_k object.

...

Ignored.

Details

The scree panel shows both PC and FA observed eigenvalues alongside their respective random-data thresholds (for whichever PA bases were requested). PA-PC compares the blue "Observed (PC)" line to the dashed PA-PC threshold; PA-FA compares the teal "Observed (FA)" line to the dotted PA-FA threshold.

The CD panel plots the mean RMSE between observed and comparison-data eigenvalues at each k. CD uses a sequential one-sided Wilcoxon test (Ruscio & Roche, 2012): a factor is retained while adding it significantly reduces RMSE (default \alpha = 0.30); the starred k is the last retained factor. The curve is shown only over the levels that were actually computed; the starred k need not be the visible minimum of the plotted curve.

Requires the ggplot2 package.

Value

A ggplot object.

See Also

suggest_k()

Examples


if (requireNamespace("ggplot2", quietly = TRUE)) {
  sk <- suggest_k(sim16, n_iter = 5)
  autoplot(sk)
}



ackwards documentation built on July 25, 2026, 1:08 a.m.