Use DEFINE in Monte Carlo simulation PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 Zachary Chang posted on Thursday, December 27, 2007 - 7:57 am
Hi,
I am wondering if the DEFINE function can be used in Monte Carlo data generation procedure. I know that when I read external data, I could use DEFINE to have a interaction term. But in the step where simulated data sets are generated, can I use define function?

In particular, my model is

Yij = b0j + b1j*Xij + rij
b0j = r00 + r01*Wj + r02*Gj + r03*Wj*Gj + u
b1j= r10 + r11*Gj + u

Can I use the following syntax to generate data?

MONTECARLO:
NAMES ARE y x w g ;
WITHIN = x;
BETWEEN = g w;
REPSAVE = ALL;
SAVE = rep*.dat;
Define:
prod = g * w;

MODEL POPULATION:
%WITHIN%
x@1;
s | y ON x;
y*.5;
%BETWEEN%
g@1; w@1;
y ON g*.3 w*.3 prod*.3 ;
s ON g*.3;
[ y*0 s*.3];

Thank you very much for your response!

Zack
 Linda K. Muthen posted on Thursday, December 27, 2007 - 8:02 am
The DEFINE command can be used only with external Monte Carlo where the data sets are saved in the first step and analyzed in the second step. See Example 11.6.
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: