Skip to content

Fix standardization of interaction terms: use SD(A)*SD(B)#501

Merged
yrosseel merged 1 commit intoyrosseel:masterfrom
felipelfv:fix-sam-interaction-dimensions
Feb 24, 2026
Merged

Fix standardization of interaction terms: use SD(A)*SD(B)#501
yrosseel merged 1 commit intoyrosseel:masterfrom
felipelfv:fix-sam-interaction-dimensions

Conversation

@felipelfv
Copy link
Contributor

Fixes #480 (partially).

For interaction terms A:B, standardizedSolution() was using SD(A:B) from diag(VETA) to standardize the coefficient. This forces Var(A:B) = 1, which is only correct when A and B are orthogonal. The correct scaling factor is SD(A)*SD(B) (Brandt et al., 2015, Eq. 13).

The fix replaces ETA[A:B] with SD(A)*SD(B) inside lav_standardize_lv(), which propagates to std.lv, std.all, and std.nox. Quadratic terms A:A are also handled (SD(A)*SD(A) = Var(A)).

This does not yet address centering adjustments for models with non-zero latent means — a warning is emitted in that case.

…D(A:B)

For interaction terms A:B, standardizedSolution() was using SD(A:B)
from the model-implied VETA, which incorrectly forces Var(A:B) = 1.
This is only correct when A and Z are orthogonal. The fix replaces
ETA[A:B] with SD(A)*SD(B) following Brandt et al. (2015, Eq. 13).
Also handles quadratic terms A:A via SD(A)*SD(A) = Var(A).

Centering adjustments for non-zero latent means are not yet
implemented; a warning is emitted when interaction terms are present.
@yrosseel yrosseel merged commit cca08de into yrosseel:master Feb 24, 2026
5 checks passed
@yrosseel
Copy link
Owner

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Naive Standardization of Interaction Models

2 participants