Monte Carlo simulation
Message/Author
 Gao Yan posted on Wednesday, September 15, 2010 - 2:10 am
Hi, I am doing the data simulation in mplus. my model is

a with b;
ab | a xwwith b;
c on a b ab;
d on a c;

but it was said the the covariance matrix is not positive.
after tried different ways. I find that when you define the algorithm=integration which is a must when you use xwith, there will be the same problem when you use with as well.

Hope I can get help here! Thanks!
 Linda K. Muthen posted on Wednesday, September 15, 2010 - 9:31 am
See mcex5.13.inp which is a Monte Carlo input for a model with a latent variable interaction. You must provide population parameter values for a simulation study. See also the Monte Carlo examples chapter and the chapter on the MONTECARLO command in the user's guide.
 Xuan Chen posted on Wednesday, January 18, 2017 - 12:11 pm
Hello Drs.Muthen,
I want to generate the clustered data do to a two-level CFA simulation. I have several interested statistics including alpha, omega which measures reliability. What I want to do is to compare the two-level estimates and single-level estimates.
I already got my two-level estimates and tried to save replicated data for single level one. As you said above, only the first repliaction of data can be saved. How can I get single level omega based on 1000 replications?
Here are my codes for two level estimate.
TITLE:...montecarlo:names are y1-y4 ;nobservations = 5000;ncsizes = 3;csizes = 40 (25) 50 (50) 100 (15);seed = 58459; nreps = 10;save = ex9.6.dat;ANALYSIS:TYPE IS TWOLEVEL;
MODEL POPULATION:
%Within%fw BY y1@1 y2*1 y3*1 y4*1;y1-y4*1;fw*1;%Between%fb BY y1@1 y2*1 y3*1 y4*1;fb*.4;y1-y4@0;
MODEL: *same as model population
model constraint: new(numw denomw omegaw hw numb denomb omegab hb); numw=(wl1+wl2+wl3+wl4)**2; denomw=((wl1+wl2+wl3+wl4)**2)+(wr1+wr2+wr3+wr4); omegaw=numw/denomw; hw=1/(1+(1/((wl1**2/wr1)+(wl2**2/wr2)+(wl3**2/wr3)+(wl4**2/wr4)))); between is similar as within
 Bengt O. Muthen posted on Wednesday, January 18, 2017 - 5:48 pm