Fix standardization of interaction terms: use SD(A)*SD(B)#501
Merged
yrosseel merged 1 commit intoyrosseel:masterfrom Feb 24, 2026
Merged
Fix standardization of interaction terms: use SD(A)*SD(B)#501yrosseel merged 1 commit intoyrosseel:masterfrom
yrosseel merged 1 commit intoyrosseel:masterfrom
Conversation
…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.
Owner
|
Great, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #480 (partially).
For interaction terms A:B,
standardizedSolution()was usingSD(A:B)fromdiag(VETA)to standardize the coefficient. This forcesVar(A:B) = 1, which is only correct when A and B are orthogonal. The correct scaling factor isSD(A)*SD(B)(Brandt et al., 2015, Eq. 13).The fix replaces
ETA[A:B]withSD(A)*SD(B)insidelav_standardize_lv(), which propagates tostd.lv,std.all, andstd.nox. Quadratic termsA:Aare 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.