View source: R/align_loadings.R
| align_loadings | R Documentation |
Rotates a fitted solution's standardized loadings by an orthogonal Q so they match a reference matrix (Procrustes) or a deterministic canonical orientation. Useful when comparing bifactor solutions across software, or when you want a reproducible orientation across reruns.
align_loadings(
x,
target = "canonical",
level = "configural",
se_method = c("approx", "none")
)
x |
An |
target |
One of:
|
level |
Only used for |
se_method |
|
Multi-group fits and esem_invariance objects are aligned per group.
Item communalities (\Sigma\lambda^2), reliability indices (omega,
ECV), and model fit are invariant under orthogonal rotation, so alignment
affects only the per-loading partition, not substantive conclusions.
An object of class aligned_loadings: a list with one
element per group, each containing
aligned standardized loading matrix (items x factors)
aligned SEs (matching shape) or NULL
the orthogonal rotation matrix applied
max / mean abs residual vs target (only when an external reference was supplied)
The attribute "method" is "canonical", "procrustes"
or "transfer".
data("HolzingerSwineford1939", package = "lavaan")
spec <- specify_model(
Visual = c("x1", "x2", "x3"),
Textual = c("x4", "x5", "x6"),
Speed = c("x7", "x8", "x9"),
data = HolzingerSwineford1939,
group = "school"
)
inv <- esem_invariance(spec)
# Canonical orientation (no external reference, deterministic)
aligned <- align_loadings(inv, target = "canonical", level = "configural")
print(aligned)
# Within-fit: align all groups to group 1's orientation
aligned <- align_loadings(inv, target = "group1", level = "configural")
## Not run:
# Align to Mplus output (requires a Mplus .out file + MplusAutomation)
mp <- MplusAutomation::readModels("besem_inv_configural.out")
tgt <- extract_mplus_loadings(mp)
aligned <- align_loadings(inv, target = tgt, level = "configural")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.