Simulation of Multilevel SEM PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
 Anonymous posted on Thursday, November 03, 2005 - 11:35 am
I'm interested in simulating a multilevel SEM. I want to control my Intraclass correlations. How would I do that in Mplus? In other words, what syntax would I use? If I missed an example in the manual, please tell me the number.

Also, is there any way to have the "results" option of Monte Carlo provide the ICC's?

Thanks so much.
 Linda K. Muthen posted on Thursday, November 03, 2005 - 5:37 pm
I am going to use Example 11.4 to describe this. An intraclass correlation is the ratio of between variability to total variability. So you increase the intraclass correlation by increasing between level variability. For example, consider y1. It's between-level variation is the same as the variability of ib because centering is done at time one. The within-level variance of y1 is the same as the iw variance plus the y1 residual variance. Using this example, the intraclass correlation for y1 is 0.2/(0.2 + 1 + 0.5) = .12.

ICC's are not saved.
 Hsien-Yuan Hsu posted on Thursday, June 14, 2007 - 10:56 am
Dr. Muthen,

I want to simulate a multilevel CFA model.
In within model, I have 6 indicators (y1-y6). Half of them(y1-y3) were predicted by a latent variable, namely, fw1; half(y4-y6) were predicted by fw2.
In between model, I have the same factor structure. Half of them(y1-y3) were predicted by a latent variable, namely, fb1; half(y1-y3) were predicted by fb2.

Q1. What is the syntax to set ICC to be equal to .25?
Q2. Are the reliabilities of each indicator in between model necessarily larger than the reliabilities in within model? Is there any suggestion/reference when I set the residuals of each indicator in between model?

Your response is much appreciated.

Hsien-Yuan Hsu
 Linda K. Muthen posted on Thursday, June 14, 2007 - 2:48 pm
Q1. ICC is the between variance divided by the between plus within variances. So adjusting the between variance changes the ICC. See the input from the Mplus CD for Example 11.4. There are comments related to ICC's.

Q2. I think this is usually the case. I don't know of any reference.
 Holmes Finch posted on Thursday, March 06, 2008 - 9:36 am
Hi Linda,

I just wanted to follow up on these questions and responses, which have been most helpful. If I'm simulating multilevel data and want to manipulate the ICC's for the latent variable, could I just do that by specifying the between and within variances for it only, or would I also need to do so for the individual indicators as well? I'm thinking of a case where I want the ICC=.25, for example. It seems to me that I could set the within variance=.25 and between=.75 for the latent variable and generate what I need. Does that logic seem sound? Thanks.

 Linda K. Muthen posted on Thursday, March 06, 2008 - 2:39 pm
The icc's for the latent variable would also require information about the residual variances of the factor indicators.
 Holmes Finch posted on Friday, March 07, 2008 - 4:36 am

Thanks very much. I always appreciate your very quick responses.

 Michael Willoughby posted on Monday, June 02, 2008 - 8:33 am
I'm interested in simulating multilevel data("disaggregated approach", per Bengt's earlier work) and then analyzing these data such that grouping is nuisance ("aggregated approach" per Bengt's earlier work....robust ML, group = cluster).

Specifically, I would like to simulate a simple 2 level model in which person level data (level 1; Sw) are predicted by a single group level (level 2; Sb) predictor (e.g,. child outcomes predicted by treatment that is assigned at classroom level).


1. Can you point me to example code where this has been done?

2. When defining population values in the monte carlo study, should the group level effect be included in within (Sw), between (Sb), or both levels models?

Thank you.
 Linda K. Muthen posted on Monday, June 02, 2008 - 9:44 am
All of the examples in Chapter 9 have Monte Carlo counterparts that were used to generate the data. I would suggest using an example closest to what you are doing as a starting point.
 Holmes Finch posted on Monday, January 05, 2009 - 8:33 am

I'm interested in simulating a multilevel, multigroup IRT model in which I control the intraclass correlations for one or more of the observed indicator variables. I've looked through several examples and can't quite see how to put that together. Could you steer me in the right direction? Thanks very much.

 Linda K. Muthen posted on Tuesday, January 06, 2009 - 10:51 am
You can combine the Monte Carlo counterparts of Example 9.11 which is a two-level multiple group CFA with continuous factor indicators and Example 5.5 which is an IRT model. In Example 9.11, you will need to use the KNOWNCLASS option and TYPE=MIXTURE instead of the GROUPING option.
 Holmes Finch posted on Tuesday, January 06, 2009 - 11:40 am

Thanks very much. I have one other question. Is it possible to assign the size of each of the latent classes analogous to using the ngroups and nobservations options for observed group sizes? Thanks very much.

 Linda K. Muthen posted on Tuesday, January 06, 2009 - 6:13 pm
You need to do that using the means of the latent class variable and then an observed variable that is the same as the latent variable. See the Monte Carlo counterpart of Example 8.8 which has a KNOWNCLASS variable.
 Holmes Finch posted on Friday, January 09, 2009 - 5:35 am
Thanks very much.
 QianLi Xue posted on Monday, October 11, 2010 - 4:26 pm
Hi, if I want to simulate a dataset based on a latent class model, say, with 4 classes. How can I specify latent class prevalence parameters in the Monte Carlo step? Could you please elaborate on your answer to the similar question above?
 Linda K. Muthen posted on Wednesday, October 13, 2010 - 12:14 pm
These are specified using a bracket statement for the means of the categorical latent variables. The population parameter values are in a logit scale where

logit = log (probability of being in a particular class divided by the probability of being in the reference class)
 QianLi Xue posted on Monday, September 19, 2011 - 3:48 am
Hi, I would like to simulate multilevel cox regression model. I'm using your example 12.10. Could you tell me how to specify the degree of ICC?
 Tihomir Asparouhov posted on Tuesday, September 20, 2011 - 10:44 am
ICC is directly related to the model parameters only for normally distributed variables in principle and not for survival variables. So it is not possible to enter ICC directly in the simulation.

The ICC will increase as you increase the total variance of the random intercept. Consider the model below similar to example 12.10

w@1 (var1);
t ON w*.2 (beta);
t*1 (var2);

This gives a random intercept variance of


You can increase any of the 3 parameters to get higher random intercept variance and higher ICC for the observed T. For each set of parameters compute the ICC of the generated data until you get to the right level (guess and check approach).
 QianLi Xue posted on Wednesday, September 21, 2011 - 12:49 pm
Thanks so much!
 Denise Kerkhoff posted on Monday, March 27, 2017 - 2:14 am

I am considering using Mplus for an upcoming research project, but I am not sure whether the program has the features I need, especially since I have just started working with the program.

I would like to use a Monte Carlo approach in order to simulate and analyze three-level nested data drawn from a population with specified fixed effects, random effects, interaction effects, potential heteroscedasticity, measurement invariance or dropout patterns for longitudinal data, or other characteristics.

I was wondering to what extent it is possible to draw the data directly from a hypothetical population via variance-covariance-matrix, or use an alternative approach that does not require actual data set creation.

I read some publications for two-level models (e.g. Muthén & Muthén, 2002), but have not come across applications for three-level (longitudinal) models.

Are such simulations feasible in Mplus, or can you maybe suggest an alternative approach for my research purposes?

Thank you very much!

Denise Kerkhoff
 Bengt O. Muthen posted on Saturday, April 01, 2017 - 5:13 pm
It seems that Mplus could do that. Mplus would generate raw data for analysis in such a case. 3-level simulations are shown for all our 3-level examples in the User' Guide which are posted on our website.
 MS, Kim posted on Monday, November 27, 2017 - 6:46 am
Hello. I have the questions.
I want to simulate multilevel mediation in MSEM.
McNeish(2017) said that it is impossible to simulate “2-1-1 model ” in mplus.
Is it right? then, now can I simulate 1-2-1 model or 2-2-1 model?
or can I simulate only 1-1-1 model?

Thank you very much!
 Bengt O. Muthen posted on Monday, November 27, 2017 - 5:07 pm
It is possible to simulate these models in Mplus. What is the full reference to that paper?
 MS, Kim posted on Monday, November 27, 2017 - 5:44 pm
Thank you for your help!, seriously!:-).

the full reference is
' McNeish, D. (2017). Multilevel mediation with small samples: A cautionary note on the multilevel structural equation modeling framework. Structural Equation Modeling: A Multidisciplinary Journal, 24(4), 609-625.'.

It is written that ' ~ the MONTECARLO utility in Mplus is not available for 2-1-1 mediation models and MCMC estimation ~.... ~We sued the
X command to call mplus as a DOS prompt form SAS when necessary. ~' in 618 page.

Then, Do you mean I can simulate to 2-1-1, 1-2-1, or 2-2-1 model by changing your example 11.11 ?

Thanks very much.
 Bengt O. Muthen posted on Tuesday, November 28, 2017 - 3:16 pm
There is no problem modifying ex 12.11 to match equations (1a-2c).

I will send you the runs.
 Tihomir Asparouhov posted on Tuesday, November 28, 2017 - 3:44 pm
Here is the 2-1-1 modification of User's Guide example 12.11

b | y ON m;
m*1; y*1;
x*1; [x*1]; b*0.6; [b*0.4];
m on x*0.3; [m*0.5]; m*0.8;
y on x*0.7; [y*2]; y*1.2;

b | y ON m;
m*1; y*1;
x*1; [x*1]; b*0.6; [b*0.4];
m on x*0.3; [m*0.5]; m*0.8;
y on x*0.7; [y*2]; y*1.2;
 Fredrik Falkenström posted on Monday, May 07, 2018 - 12:14 pm
Hi, I wonder why the ICC is not always calculated in multilevel models? I am doing a two level Monte Carlo study, and in some of my models I get ICC estimates for the included variables in the "summary of data for the first replication" but sometimes this field is empty?


Fredrik Falkenström
 Bengt O. Muthen posted on Monday, May 07, 2018 - 5:32 pm
Please send the output for when it doesn't show up to Support along with your license number.
Back to top
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message