View source: R/alignment_check.R
| alignment_check | R Documentation |
Tests whether a standard CFA (ICM-CFA) is appropriately specified by computing alignment ratios from the manifest correlation matrix. Based on Mehrvarz & Rouder (2026), who prove that in a correctly specified ICM-CFA, alignment ratios must be invariant across all admissible item quadruples, with the common value equal to the squared latent correlation phi^2.
alignment_check(
data,
clusters,
cfa_fit = NULL,
is_cor = FALSE,
min_within_r = 0.05,
log_sd_thresholds = c(slight = 0.64, moderate = 1.6)
)
data |
A |
clusters |
A named character vector mapping item names to factor names.
Example: |
cfa_fit |
Optional. A fitted |
is_cor |
Logical. Is |
min_within_r |
Numeric. Alignment ratios whose denominator contains a
within-cluster correlation below this value are excluded (near-zero
within-cluster correlations make ratios numerically unstable). Default
|
log_sd_thresholds |
Named numeric vector of log-scale SD cutoffs for
the slight / moderate / high misalignment classification. Defaults to the
empirical terciles reported by Mehrvarz & Rouder (2026, p.24):
|
s = \mathrm{sd}(\log Q) is the primary diagnostic. The log scale is
natural because alignment ratios are multiplicative objects. Mehrvarz &
Rouder (2026, p.24) report empirical terciles of s from their bifactor
misalignment simulation:
s < 0.64 – Slight misalignment. ICM-CFA is approximately consistent with the data; latent correlations are roughly trustworthy.
s 0.64-1.6 – Moderate misalignment. ICM-CFA is partially misspecified; interpret latent correlations with caution.
s > 1.6 – High misalignment (top tercile of the paper's simulation, up to ~4.4). ICM-CFA is substantially misspecified and latent correlations are likely inflated. Consider ESEM.
These cutpoints are the 33rd and 66th percentiles of s observed by
Mehrvarz & Rouder across a broad range of simulated loading configurations
(with \mathrm{sd}(\log \kappa_j) \in [0, 3]), not hard decision
boundaries; adjust log_sd_thresholds if your application calls for
stricter or looser cutoffs.
Misassignment: items are assigned to the wrong cluster. Mehrvarz & Rouder prove this necessarily inflates phi. The alignment ratios split into three plateaus at phi^2, 1, and 1/phi^2.
Misalignment: cluster assignments are correct but cross-loadings exist (or the proportionality constraint is violated in a bifactor-like DGP). The ratios are dispersed rather than invariant.
Mehrvarz & Rouder (2026, p.14) count one alignment ratio per admissible
index quadruple: n_Q = \binom{m_A}{2}\binom{m_B}{2}. Because each
unordered quadruple \{\ell, \ell'\} \times \{k, k'\} admits two
between-cluster matchings ((\ell,k)/(\ell',k') and
(\ell,k')/(\ell',k)), both of which equal \varphi^2 under
correctly specified ICM-CFA but diverge under misspecification, this
function records both matchings per quadruple – yielding 2 \binom{m_A}
{2}\binom{m_B}{2} ratios in all_ratios – to maximise the
information available for the dispersion diagnostic.
An object of class "alignment_check" (a list) containing:
pair_resultsA data.frame with one row per factor
pair, giving: geometric mean of alignment ratios, log-scale SD, implied phi,
CFA-estimated phi (if supplied), inflation percentage, and verdict.
all_ratiosA named list of raw alignment ratio vectors, one element per factor pair.
recommendationCharacter string: overall recommendation.
cor_matrixThe manifest correlation matrix used.
clustersResolved cluster assignments (named list).
callThe matched call.
For any two items \ell, \ell' in cluster A and two items k, k'
in cluster B, the alignment ratio is:
Q(\ell, \ell', k, k') = \frac{r_{\ell k} \cdot r_{\ell' k'}}{r_{\ell \ell'} \cdot r_{k k'}}
Under a correctly specified ICM-CFA, all such ratios equal phi^2 and lie in
[0, 1] (Mehrvarz & Rouder, 2026, Eq. 5). Dispersion in the ratios –
measured by their log-scale standard deviation s = \mathrm{sd}(\log Q)
– signals misspecification: either misassignment (items in the wrong
cluster) or misalignment (cross-loadings exist but are fixed to zero).
Mehrvarz, M., & Rouder, J. N. (2026). The geometry and brittleness of latent correlations in confirmatory factor analysis.
esem for the recommended follow-up under moderate or
high misalignment.
data("HolzingerSwineford1939", package = "lavaan")
d <- HolzingerSwineford1939[, paste0("x", 1:9)]
# Vector form of cluster assignment
clusters <- c(
x1 = "Visual", x2 = "Visual", x3 = "Visual",
x4 = "Textual", x5 = "Textual", x6 = "Textual",
x7 = "Speed", x8 = "Speed", x9 = "Speed"
)
# Run alignment check (data only)
check <- alignment_check(d, clusters)
print(check)
# Run with a fitted CFA to quantify inflation
cfa_model <- "
Visual =~ x1 + x2 + x3
Textual =~ x4 + x5 + x6
Speed =~ x7 + x8 + x9
"
cfa_fit <- lavaan::cfa(cfa_model, data = d, std.lv = TRUE)
check <- alignment_check(d, clusters, cfa_fit = cfa_fit)
print(check)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.