Monte Carlo with CFA and multiple groups PreviousNext
Mplus Discussion > Confirmatory Factor Analysis >
Message/Author
 Roger E. Millsap posted on Thursday, February 19, 2009 - 10:23 am
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 two-grp 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;
 Linda K. Muthen posted on Thursday, February 19, 2009 - 11:22 am
See mcex5.14.inp. You need a group-specific 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.
 Roger E. Millsap posted on Thursday, February 19, 2009 - 1:45 pm
Thanks. Where is the mcex5.14.inp example to be found?
 Linda K. Muthen posted on Thursday, February 19, 2009 - 3:09 pm
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 x1-x4;
NOBSERVATIONS = 500 500;
NREPS = 500;
NGROUPS = 2;

MODEL POPULATION:
[x1@.225];
[x2@.025];
[x3@.010];
[x4@.240];

x1-x4@.96;

f1@1;
f1 BY x1*.3 x2*.5 x3*.9 x4*.7;

MODEL POPULATION-g2:
[x1@.100];
[x2@-.225];
[x3@.240];
[x4@-.025];

x1-x4@.96;

f1@1;
f1 BY x1*.3 x2*.5 x3*.7 x4*.5;

Thank you.
 Bengt O. Muthen posted on Tuesday, September 04, 2012 - 6:13 am
If you mean "can Mplus automatically do the chi-square testing of the invariance model against the non-invariance 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 multi-group?

Thanks.

Tom
 Linda K. Muthen posted on Sunday, March 03, 2013 - 10:35 am
If the RESIDUAL option is available for your analysis, this should give you what you want.
 Heiko Breitsohl posted on Monday, May 02, 2016 - 8:38 am
Hi Linda and Bengt,

I am trying to determine the sample size for a four-group 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 effects-coding approach into a Montecarlo model?

Thanks so much!
Heiko
 Bengt O. Muthen posted on Monday, May 02, 2016 - 9:36 am
Have you checked that you get the same number of parameters as in "a regular" multiple-group model? Maybe you got one or two more than you intended.
 Heiko Breitsohl posted on Thursday, May 05, 2016 - 9:15 am
Thanks! I think I found the source of the problem.
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: