sfa_nfactors: Unified Factor Retention Diagnostics

View source: R/retention.R

sfa_nfactorsR Documentation

Unified Factor Retention Diagnostics

Description

Runs multiple factor retention methods on an embedding similarity matrix and tabulates the results, mirroring the workflow of N_FACTORS.

Usage

sfa_nfactors(
  sim_matrix,
  embeddings = NULL,
  methods = "parallel",
  seed = 42L,
  parallel_iter = 100L,
  max_factors = NULL,
  rotate = "oblimin",
  fm = "minres",
  ...
)

Arguments

sim_matrix

Numeric similarity matrix (n_items x n_items).

embeddings

Numeric embedding matrix (n_items x embedding_dim). Required when "parallel" or "EKC" is in methods.

methods

Character vector of retention methods to run. Supported: "parallel" (sfa_parallel()), "kaiser" (latent-root criterion), "TEFI", "EGA" (requires EGAnet), "EKC" (sfa_ekc()), "MAP" (sfa_map()), and "semk" (sfa_semk(), the calibrated learned rule; requires Python and a one-time model download). The default runs parallel analysis alone, matching the field's conventional retention default; request the multi-criterion battery explicitly (the package's own demonstration uses c("parallel", "kaiser", "TEFI", "EGA", "EKC")). Notes for choosing: EGA needs the suggested EGAnet package; the latent-root rule is retained for reference despite its known liberal bias; TEFI tends to run low on embedding similarity matrices; MAP tends to track reliable minor structure well past the interpretable factor count, which would pull the modal consensus deep; and sem-k is the only criterion with validated planted-truth error rates on embedding matrices (its classical battery votes are consumed internally as features, so a consensus mixing sem-k with those same criteria double-counts them).

seed

Random seed for parallel analysis.

parallel_iter

Iterations for parallel analysis.

max_factors

Maximum factors to test for TEFI (default: auto).

rotate

Rotation for TEFI extraction (default "oblimin").

fm

Extraction method for TEFI (default "minres").

...

Additional arguments (currently unused).

Value

An object of class "sfa_nfactors" with:

methods

Data frame with one row per method: method name, suggested n_factors.

consensus

Integer: modal recommendation across methods. When two or more recommendations tie for the mode, the smallest tied value is returned (the more parsimonious solution). With a single method this equals that method's suggestion, and print() omits the consensus line.

eigenvalues

Numeric vector: observed eigenvalues.

parallel

Parallel analysis result (if run), or NULL.


semanticfa documentation built on Sept. 2, 2026, 1:07 a.m.