Message/Author 


Hi, I want to use the monte carlo facility to generate data for two independent groups, and then fit a CFA model in each group. Here is some syntax that I wrote, which runs but does not properly set up the populations (i.e., the fixed parameter values are not as I specified). Can you tell me if I am on the right track with my syntax? TITLE: simulations for twogrp p=2 model MONTECARLO: NAMES ARE z1 y1; NGROUPS = 2; NOBSERVATIONS = 200 200; NREPS = 5; SEED = 897; MODEL POPULATION: f1 BY z1@1.0 y1@.6; [f1@0]; [z1@.5 y1@.3]; f1@.5; z1@.21; y1@.18; MODEL f1 BY z1@1.0 y1*; z1(1); y1(2); f1(3); MODEL POPULATION: f1 BY z1@1.0 y1@.6; [f1@.3]; [z1@.5 y1@.3]; f1@.5; z1@.21; y1@.18; MODEL G2: [f1*]; OUTPUT: TECH9; 


See mcex5.14.inp. You need a groupspecific MODEL POPULATION command. You also need a colon after the first MODEL command. If you continue to have problems with this, send your output and license number to support@statmodel.com. 


Thanks. Where is the mcex5.14.inp example to be found? 


It is put on the hard disk when the program is installed. Check Program Files/Mplus and you should see the examples. Each example in the user's guide has a Monte Carlo counterpart that was used to generate the data for the examples. All examples and Monte Carlo counterparts come on the Mplus CD. They are also available on the website. 

Jisoo Ock posted on Monday, September 03, 2012  4:14 pm



Hello, I wanted to use the Monte Carlo function to generate data for two independent groups, and then conduct measurement invariance analysis on each of the generated data (e.g., a metric invariance analysis with indicator x1 serving as the referent indicator and rest of the indicator loadings constrained to be equal). Is it possible to write a MODEL command so that the program generates the data and does the invariance analysis? Here is my syntax: TITLE: Sample simulation MONTECARLO: NAMES ARE x1x4; NOBSERVATIONS = 500 500; NREPS = 500; NGROUPS = 2; MODEL POPULATION: [x1@.225]; [x2@.025]; [x3@.010]; [x4@.240]; x1x4@.96; f1@1; f1 BY x1*.3 x2*.5 x3*.9 x4*.7; MODEL POPULATIONg2: [x1@.100]; [x2@.225]; [x3@.240]; [x4@.025]; x1x4@.96; f1@1; f1 BY x1*.3 x2*.5 x3*.7 x4*.5; Thank you. 


If you mean "can Mplus automatically do the chisquare testing of the invariance model against the noninvariance model" in a Monte Carlo run, the answer is no. People have done that via external Monte Carlo and matching up the replications by other programs, such as the R program MplusAutomation. 

Tom Booth posted on Saturday, March 02, 2013  7:58 am



Hi Linda/Bengt, A quick question.Is it possible to request (either as output to be extracted or simply viewed) the population covariance matrices from which the data is generated in the Monte Carlo procedure when the population model is multigroup? Thanks. Tom 


If the RESIDUAL option is available for your analysis, this should give you what you want. 


Hi Linda and Bengt, I am trying to determine the sample size for a fourgroup model with a single latent factor using effects coding for identification. [I want the factor to be scaled like the indicators.] The goal is to compare the latent means between groups. When I generate the population data as usual (factor variance fixed to one, factor mean fixed to zero in Group 1) and specify MODEL with effects coding (factor loadings sum to one, interceps sum to zero, latent variances and means in all groups freely estimated), Mplus tells me that my model is not identified. How can I incorporate the effectscoding approach into a Montecarlo model? Thanks so much! Heiko 


Have you checked that you get the same number of parameters as in "a regular" multiplegroup model? Maybe you got one or two more than you intended. 


Thanks! I think I found the source of the problem. 

Yue Yin posted on Thursday, January 03, 2019  1:42 pm



Montecarlo: name=u1u6 x1; generate=u1u6(1); categorical=u1u6; ngroups=2; nobs=150 150; nreps=20; repsave=all; save=rep*.dat Model population: [x1@0]; x1@1; f by u1*9 u2*.7 u3*.6 u4*.8 u5*.7 u6*.6; f*1; f on x1*.5; u1*.3 u2*.3 u3*.3 u4*.3 u5*.3 u6*.3; [u1$1*.15]; [u2$1*.25]; [u3$1*.15]; [u4$1*.25]; [u5$1*.10]; [u6$1*.10]; model populationg2: f by u2*.5 u3*.4 ; Hi, I want use monte carlo to created a data which has loading difference across groups, but after I run it, error said the error can't be computed, model is not identified. I can't figure out what the problem: Parameter 19, Group G2: F THE CONDITION NUMBER IS 0.278D17. Could you help me with it? Thank you. 


Your input should also have Model statements. If this doesn't help, send your output to Support along with your license number. 

Daniel Lee posted on Wednesday, February 06, 2019  8:58 pm



If you are doing a MC simulation study to determine power for a multigroup path model, and X (Exogenous variable) is binary, how do you set cutpoints for X across both groups? Thank you. 


Check UG examples that have multiplegroup analysis with Xs. All UG examples have Monte Carlo counterparts on our website. 

Back to top 