| sfa_dimselect | R Documentation |
Selects how many leading embedding coordinates ("depth") to use before factor analysis, instead of defaulting to the full vector. This adapts the depth-optimization objective of Golino (2026); it is not a reimplementation of Dynamic EGA (DynEGA) – it does not perform DynEGA's time-delay embedding or derivative (GLLA) estimation, but applies static EGA at each depth and optimizes Golino's composite. Following Golino (2026), the embedding is treated as a searchable landscape: structural information is not uniformly distributed across coordinates, so a sub-range of dimensions can recover the construct structure more cleanly than the whole vector (and denoise the over-factoring seen with some embedding models).
sfa_dimselect(
embeddings,
factors = NULL,
scoring = NULL,
encoding = "atomic",
min_depth = 3L,
max_depth = NULL,
step = NULL,
max_eval = 150L,
weights = c(nmi = 0.7, tefi = 0.3),
algorithm = "walktrap"
)
embeddings |
Numeric matrix (n_items x embedding_dim). |
factors |
Optional character/factor vector of theoretical labels, one
per item, enabling the NMI term. If |
scoring |
Optional numeric +1/-1 vector (keying), passed to the similarity transform. |
encoding |
Similarity transform used at each depth (default
|
min_depth |
Smallest depth to evaluate (default 3, with a minimum of 3 imposed for TMFG stability). |
max_depth |
Largest depth to evaluate (default: full embedding dimension). |
step |
Depth increment. Default chooses a step giving at most
|
max_eval |
Soft cap on the number of depths evaluated when |
weights |
Named numeric vector |
algorithm |
Community-detection algorithm passed to EGAnet
(default |
The coordinate index is swept as an ordered depth axis. The function sweeps
increasing depths d; at each depth it builds the item-by-item
association matrix from the first d coordinates, estimates the network
with the Triangulated Maximally Filtered Graph (TMFG) and detects communities
with the Walktrap algorithm (both via EGAnet, as in Golino 2026), then
scores the resulting partition with:
the Total Entropy Fit Index (TEFI; lower is better), and
Normalized Mutual Information (NMI) against the theoretical factor labels, when available (higher is better).
Both metrics are min-max normalized across the swept depths and combined into
a composite C(d) = w_{NMI}\,NMI_{norm} - w_{TEFI}\,TEFI_{norm}
(default weights 0.70 / 0.30, per Golino 2026). The depth maximizing
C is returned. With no theoretical labels the selection falls back to
minimizing TEFI alone (less reliable; a single metric can yield structurally
incoherent optima).
An object of class "sfa_dimselect": a list with
optimal_depth, the full trajectory data frame (depth, n_dim,
nmi, tefi, and normalized/composite columns), the weights used, and
full_dim.
Depth is scored with the EGA network / Walktrap partition (Golino's engine).
When the chosen depth then feeds fa-based extraction
(the default in sfa), the subspace that is best for EGA
recovery is not guaranteed to be best for the EFA solution. For results that
match the selection criterion, pair dim_select = "dynega" with
n_factors_method = "EGA". Golino (2026) also reports the largest
gains for moderate-to-large item pools (roughly 10–20+ items per
dimension); short scales may see little or no benefit.
Golino, H. (2026). Optimizing the landscape of LLM embeddings with Dynamic Exploratory Graph Analysis for generative psychometrics: A Monte Carlo study. Manuscript under review, Proceedings of the 90th Annual International Meeting of the Psychometric Society. arXiv:2601.17010.
sfa (use dim_select = "dynega"),
sfa_similarity
data(big5)
if (requireNamespace("EGAnet", quietly = TRUE)) {
# small depth grid for a quick illustration
ds <- sfa_dimselect(big5$embeddings, factors = big5$factors,
scoring = big5$scoring, max_depth = 80, step = 20)
ds$optimal_depth
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.