Data simulation for moderation models
Message/Author
 Christoph Weber posted on Thursday, July 26, 2012 - 2:12 am
Dear Dr. Muthen,
I want't to simulate data for the following model:
Y = b1*X + b2*Z + b3*X² + b4*XZ + b5*X²Z

Is it possible to use the xwith command?
Or would this lead to biased data due to fact that even when X and Z are normally distributed, X² will not. Thus, b5 will be overestimated because of the sensitivity of the LMS approach to nonnormal data.
Or isn't this a problem, when I constrain the b-weights?

tanks
Christoph Weber
 Linda K. Muthen posted on Thursday, July 26, 2012 - 11:50 am
Normality is not an issue for observed exogenous variables. The model is estimated conditioned on them and no distributional assumptions are made about them.

We can send you something about generating data with interactions. It is complex to do and we can't offer any help other than a few descriptive pages. If you are interested, let me know.
 Christoph Weber posted on Thursday, July 26, 2012 - 12:07 pm
Yes, I would appreciate your help.
I have forgotten to mention that Y, X and Z should be latent variables, each measured by three items.
Thanks
Christoph Weber
 Jindow Joseph posted on Friday, March 01, 2013 - 11:12 am
Hello Dr.Muthen,

I was just working with a (modified) program that I got from a research paper (Little 2006) when I observed a strange thing:

TITLE: Data generation syntax.

MONTECARLO:
NAMES ARE y1 y2 y3 x1 x2 x3 z1 z2 z3;
NOBSERVATIONS = 1500;
NREPS = 2;
SEED = 53487;
REPSAVE = ALL;
SAVE = C:\M\data*.txt;

ANALYSIS:TYPE = RANDOM;
ALGORITHM = INTEGRATION;

MODEL MONTECARLO:
[x1-x3*3 z1-z3*3 y1-y3*3];
x1-x3*.3; z1-z3*.3; y1-y3*.3;
C BY x1*.7 x2*.7 x3*.7;
Z BY z1*.7 z2*.7 z3*.7;
Y BY y1*.7 y2*.7 y3*.7;
C@1; Y@1; Z@1;
CZ | C XWITH Z;
Y ON C*.4 Z*.4 CZ*.2;
Z WITH C*.3;

When I execute the above code, I get an error:
*** ERROR in MODEL POPULATION command
Variances for the categorical latent variables are not currently defined.
Variance given for: C

However if I change all occurrences of "C" in the code, for example to D, the error goes off. What is happening here? Is "C" reserved as a categorical variable or something like that?
 Linda K. Muthen posted on Friday, March 01, 2013 - 12:11 pm
It sounds like that is the case.