Message/Author 


Hello, I was trying out the Monte Carlo modelling, in Mplus, using the first example from Muthen and Muthen  How To Use A Monte Carlo Study To Decide On Sample Size and Determine Power. I get two error messages: First: Your Text*** ERROR in Montecarlo command Unknown option: GCLASSES I stopped that error by changing gclasses to genclasses, but I'm not positive that's correct. But then I get: *** ERROR in Montecarlo command Unknown option: NCLASSES. And I wasn't sure how to correct that one. I'm using Mplus v3.11. Thanks, Jeremy P.S. I've left the manual at home, and was trying to respond to this message, on a mailing list with a Monte Carlo simulation. Although if anyone thinks I'm wrong (or right) they could post to the list. (I think you have to join it, at www.jiscmail.ac.uk, but it's not got a lot of traffic. 


GCLASSES has been changed to GENCLASSES. And NCLASSES has been changed to CLASSES in Version 3. If you are away from your user's guide in the future, the last chapter which summarizes all of the Mplus language can be found at www.statmodel.com under the Demo. 


One more thing. The Mplus Version 3 CD comes with all of the examples from the Mplus User's Guide plus Monte Carlo counterparts of most of these examples. These are a good place to start if you want to do a Monte Carlo study. 


When conducting a monte carlo run such as the example 11.5 in the manual is there any way to obtain the population covariance matrix. 

BMuthen posted on Saturday, November 12, 2005  5:43 pm



This is not part of the output in a Monte Carlo analysis. You would use the MODEL POPULATION model from your Monte Carlo analysis in the MODEL command of a regular analysis with all parameters fixed to the population values. Use as data in this regular analysis a matrix of means zero, variances one, and covariances zero. Ask for RESIDUAL in the OUTPUT command. The estimated matrix you obtain is the population covariance matrix. 

CG posted on Thursday, January 18, 2007  9:32 am



I am interested in running a CFA model simulation in MPLUS. I have two questions: 1) I have external datafiles (like example 11.6) that I wish to read. While I've saved the data files as separate files, I can't get MPLUS to read in the successive datasets. Here is an example, where the files are named MPLUS.rep1.dat, MPLUS.rep2.dat (following example 11.6) TITLE: try1 data: FILE IS MPLUS.replist.DAT; TYPE IS MONTECARLO; VARIABLE: NAMES ARE Y1Y10; MODEL: F1 BY Y1Y5; F2 BY Y6Y10; 2) If the save data command is used, are the parameters that are saved standardized or unstandardized? If unstandardized, how can they be converted to standardized parameters? thank you 


Please send your output and license number to support@statmodel.com so I can see what error message you are getting. The unstandardized coefficients are saved. You would have to standardize them if you want the standardized parameters. 

CG posted on Thursday, January 18, 2007  10:42 am



Thank you, I will send my output. Regarding computing standardized parameters, can this be done using the MPLUS output information saved in the SAVEDATA file? If so, how? 


If you want to standardize the saved raw parameter estimates, you need to find the appropriate variances, turn them into standard deviations, and apply the proper formulas to each estimate. 

Gareth posted on Thursday, February 07, 2008  3:50 am



In the example for a growth model (normal, no missing data, with covariate) monte carlo study to determine sample size, could you tell me how [x@0]; x@1; corresponds to a mean of 0.5 and a variance of 0.25 for the dichotomous covariate? If square brackets indicate means and x@1 indicates variance I'm not sure what I'm missing. Thank you in advance 


I think you will find that the CUTPOINTS option is used to make x a binary variable. 


I would like to compare factor score estimates for different models (i.e., IRT, ordinary FA with ML estimation, and FA with WLSMV for categorical data) by running a Monte Carlo simulation. For this, I need factor scores to be generated for every run of each model. Is it true that this cannot be done in Mplus (since the savedata=fscores option is not available for type=montecarlo)? And if so, could you suggest an alternative way of obtaining factor scores for each replication? Thank you in advance 


You would need to run the analysis for each data set separately if you want factor scores. 


Hello, I am attempting to conduct a Monte Carlo study (using the external Monte Carlo procedure) in which I simulate data for two groups, each of which has a different underlying factor model (e.g., there are groupbased differences in factor loadings). Subsequent to this I hope to analyze the data ignoring group membership. In step 1 of the procedure, the population values (e.g., of the factor loadings) in the output are consistent with what I've specified in my population model. However, the average estimates seem to be higher than what I would have anticipated, and I am concerned that this suggests I've made an error. On the other hand, this may be due to the fact that I have fixed an invariant factor loading to 1 in each of the groups in the subsequent model statement (i.e,. the model statement that follows the population model statement.) Should the average estimates in each group approximate the values specified in the population model, or is it likely that the discrepancies I'm concerned about are due to my identification constraint in the subsequent model statement? Thank you very much for your assistance with this! 


Try using 10 replications and 10,000 observations. If the average values do not match the population values, then you are most likely doing something wrong. If you are fixing the first factor loading to one now but generated the data with all factor loadings free and the factor variance fixed to one, this may be an issue. 


Thank you for your response. I tried what you suggested and had similar results. To clarify, my goal is to generate data for two groups, each with specified population values for factor loadings, residual variances, and factor means and variances. Subsequent to this I will analyze the data generated in step 1 (using type = montecarlo and the list.dat file created in the first step.) Since posting my question I found the following response to a question on another thread: "Example 11.6 shows how to save data for a subsequent external Monte Carlo. You don't need the MODEL command if you are only saving the data. You do need the ANALYSIS command. Nothing in the MODEL command affects data generation." If my goal is to generate data in the first step that will be saved and used in subsequent analyses, it sounds from this like I may not need to be concerned with the model statement in the first step that seems to be giving rise to the odd average parameter estimates? The average parameter values for the residual variances are consistent with the population values. The factor loadings are not, and the values of the factor loadings change depending upon which item I fix to 1. Furthermore, if I omit the model statement, my output does not include information on the population values of the parameters I specified in the population model statement  I only get information on the item variances. 


Why do you need to use external Monte Carlo? This is usually done when internal Monte Carlo cannot be done. You don't need the MODEL command when only generating data because the data are generated according to the model specified in the MODEL POPULATION command not the MODEL command. 


Dear Mplus Team and Forum Members, I’m new to Monte Carlo simulations so any advice you could offer is greatly appreciated. I’ve performed a CFA of a 48item questionnaire (correlated fourfactor model) with 345 participants (CFI = .48, TLI = .45, SRMR = .09, RMSEA = .090, 90% CI = .087 to .093). I’ve subsequently revealed similar findings of inadequate model fit using ESEM. Another reviewer has requested that I provide some justification for adequacy of the sample, referring me to the following paper: Myers, Ahn, and Ying (2011) I’ve also read Muthén and Muthén’s (2002) paper. I’m interested in estimating the amount of power I will have with my fixed sample size of 345 participants. Thus, I was hoping you might be able to shed light on the following questions: 1. As there are no previous factor analytical studies of this measure, despite being employed in over 15 published studies now, is it justifiable for me to use the parameters from my CFA analysis as input for the population parameter estimates? My concern in this regard relates to the large degree of model misfit. 2. If using the parameters from my CFA model is not recommended, how else could I go about creating values for the population estimates with no other empirical data? Or is there some other method(s) that I could explore for estimating power post hoc? Many thanks in advance. Cheers, Daniel 


If the model fits poorly, this will not work. I question whether your data support four factors if the ESEM does not fit. You should do an EFA with these data to see how many factors are actually represented. If you are not using MLR, I would suggest that. 

Stephen Cox posted on Sunday, February 03, 2013  3:24 pm



Hi there  I am trying to install the runall utility so as to read in externally generated files for analysis. I have a 64bit windows system, with which the runall utility appears incompatible. Is this correct? Is there a version for the 64bit version of Mplus? 


You should instead use external Monte Carlo. See Step 2 of Example 12.6. This has replaced RUNALL. 

Stephen Cox posted on Wednesday, February 06, 2013  4:50 pm



Thanks  I have made good progress. I am having trouble getting my population defined correctly. Below is a simplified 2 factor CFA model I am testing using external monte carlo. My problem is with defining the population covariance of the two latents (called global and study). The model runs if I do not include a population value, or leave the covariance statement out, but then sets the population value at 0 (thus the model does not fit). If I include a population value, as shown below, the model does not converge (it says I have no free paramters). What am I doing wrong? Data: file = resamplereplist.dat; type = montecarlo; Variable: Names = blah blah; usevariables = blah blah; Model: global by ycopia8@1; global by ycopia9*1.22 (p2); global by ycopia10*1.054 (p3); global by ycopia11*.546 (p4); study by ycopia15@1 (p5); study by ycopia16*1.261 (p6); study by ycopia17*1.216 (p7); study by ycopia18*.654 (p8); study with global*.514; SAVEDATA: results = resamplea.dat; 


Please send the output and your license number to support@statmodel.com. 


Hello  I am trying to run a monte carlo for a higherorder factor model. I am mostly interested in power for the factor loadings. I'm using standardized factor loadings from previous research for the model and had a question about how to set the residuals for the firstorder factors. Right now, my model is: F1 BY x1*.90 x2*.84 x3*.84; F2 BY x4*.77 x5*.81 x6*.68; F3 BY x7*.62 x8*.66; F4 BY x9*.81 x10*.74; higherOr BY F1*.85 F2*.63 F3*.86 F4*.84; F1@.2775; F2@.6031; F3@.2604; F4@.2944; higherOr@1; x1*.19; x2*.29; x3*.29; x4*.41; x5*.34; x6*.54; x7*.62; x8*.56; x9*.34; x10*.45; I am setting starting values for the indicator residuals by subtracting the squared 1st order factor loading from 1. My question is: Should the firstorder factor variances be fixed using the same method, by subtracting the the squared secondorder factor loading from 1 (as I have in the example above)? Or would the first order residual variances be set to 1? Something has to be fixed for the model to be identified, and I've searched to find out what the appropriate method would be for this. Any help would be greatly appreciated! 


I would assume that your original analysis has f1f4 variances of 1 (it looks like it), which means that subtracting squared 1storder loadings from 1 gives you the resvars of the factor indicators. You can fix the 1storder resvars to the values you show  those values don't need to be 1. 


Thank you for the clarification! 


Hello, I am trying to estimate Power based on a CFA model I estimated that had 10 continuous indicator variables, 3 latent factors, and a sample size of 179. Is it acceptable to use the parameter estimates of the CFA model (generated from the SVALUES command) in BOTH of the following sections of the syntax for the montecarlo analysis? MODEL POPULATION: MODEL: Thanks 


If that is your best estimate of your population parameter values, yes. 

Back to top 