Generating a new latent variable that...
Message/Author
 Shige Song posted on Wednesday, December 20, 2006 - 9:19 pm
the difference of another two latent variables. For example, I have two sequential growth processes and I want to get the difference of the two intercepts:

----------------
level trend | ht0*-12 ht1*-11 ht2*-10 ht3*-9 ht4*-8 ht5*-7 ht6*-6 ht7*-5 ht8*-4 ht9*-3 ht10*-2 ht11@-1 ht12@0;

i s | ht91@0 ht94@1 ht98*2;

dif | i - level;
----------------

where "level" and "trend" are latent growth factors for the first process and "i" and "s" are latent growth factors for the second process. I want to create a new latent variable that is the difference of the two latent growth factors "level" and "i".

Mplus reports that this is a syntax error "Unable to expand variable list: I - LEVEL"

The interaction of two latent variables can be generated using the "xwith" statement, but I could not find how to get the difference between two latent variable .

Thanks for any suggestions!

Shige
 Bengt O. Muthen posted on Thursday, December 21, 2006 - 4:01 pm
You have to define a new factor that is equal to i - level. You can do that as follows:

fdif by;
fdif on i@1 level@-1; fdif@0; [fdif@0];

This defines the new factor fdif as

fdif = 0 + 1*i-1*level+0
 alessandra monni posted on Tuesday, August 21, 2018 - 2:17 am
Dear Mplus team,
I have two personality traits (2 latent variable A B) and I want to generate 2 new latent variable that indicate the difference between these two variables(A-B and B-A).
The difference should indicate how much one personality trait is higher than the other on each participant.
Do you have any suggestion on the script?
 Bengt O. Muthen posted on Tuesday, August 21, 2018 - 6:04 pm
Try

Diff BY A@1 B@-1;