Message/Author 

WJCAO posted on Tuesday, September 20, 2011  7:16 am



Hi, I'm trying to use Montecarlo in Mplus to generate 40 categorical variables with 6 factors.Then MLR were used to analysis these data.But I got error: *** ERROR in MODEL command EFA factors are not allowed with ALGORITHM=INTEGRATION. EFA factors are declared with (*label). Montecarlo: names are y1y40; nobservations = 500; nreps = 500; seed = 12345; generate = y1y40(3 p); categorical = y1y40; Model population: f1 by y1y5* .4; f2 by y6y13* .5; f3 by y14y21* .6; f4 by y22y27* .7; f5 by y28y33* .8; f6 by y34y40* .9; y1y40* 1; f1f6*1; ANALYSIS: ESTIMATOR = MLR; Model: f1 by y1y5* .4 y6y40*0 (*1); f2 by y1y5*0 y6y13* .5 y13y40*0(*1); f3 by y1y13*0 y14y21* .6 y21y40*0(*1); f4 by y1y21*0 y22y27* .7 y28y40*0(*1); f5 by y1y27*0 y28y33* .8 y34y40*0(*1); f6 by y1y33*0 y34y40* .9(*1); y1y40* 1; f1f6*1; OUTPUT: TECH9; 


I think this can be done only with the WLSMV estimator. Try that. 

WJCAO posted on Tuesday, September 20, 2011  6:27 pm



Thank you.But I know we can use MLR with categorical outcomes for regular EFA or for CFA.And in this simmulation, the aim of our research is to recover the difference between MLR and WLSMV. So, under this scenario, what can I do? 


You would need to generate the data and save the data sets in one step and analyze each data set separately and put the results together yourself. Mplusautomation may be helpful. See the lefthand column fo the website for further information. 

WJCAO posted on Wednesday, September 21, 2011  8:18 am



Thank you. I have do as you said.But I cannot generate data sucessfully.And the EXAMPLE 11.5 in Mplus User's Guide cannot do too. The data I got is not a four category indicators. Montecarlo: names are y1y40; nobservations = 500; nreps = 1; seed = 12345; generate = y1y40(3 p); categorical = y1y40; save=M1.dat; Model population: f1 by y1y5* .4; f2 by y6y13* .5; f3 by y14y21* .6; f4 by y22y27* .7; f5 by y28y33* .8; f6 by y34y40* .9; y1y40* 1; f1f6@1; 


You need to give threshold population parameter values in MODEL POPULATION. See mcex7.6 where threecategory variables are generated. 

Ai Ye posted on Sunday, February 21, 2016  8:48 am



Hi, I want to conduct a simulation to evaluate the estimation of covariance effect in LTA under varying conditions: measurement quality,effect sizes, etc. I started with a simply model with 2 classes over 2 time point. Now I want to ask about how to specify the conditions in my model: 1.If I want to monitor the entropy level (0.4, 0.6, 0.8), should I change the value I used for conditional probability threshold? Is it that if I used a bigger value, say u11$1*50 versus u11$1*1, will I get a bigger entropy? Also, would the covariance effect on the latent class (c1#1 on x*.5) and the transition (c2#1 ON c1#1*2.5) matters to entropy? 2.In my model population, can I specify the transition probability of the simulated model, or the transitions supposed to be pretty random? As you see, I want to monitor the transition in a way that a large chunk of observation will transition from class 1 to class 2 whereas class 2 will stay at class 2, and I used the code “c2#1 ON c1#1*2.5”. When I specify as well c2#2 ON c1#2*2.5, I would get an error message, so I guess I only need to specify one transition of the four possibilities? But anyway, from the analysis output I got using this simulated model, the transition patterns and probabilities are so random (with almost equal percentage of pattern 1 1, 1 2, 2 2, 2 1). Did I do anything wrong in the code or it is impossible to control the transition pattern? Thank you! 

Ai Ye posted on Sunday, February 21, 2016  8:50 am



I want to post the code I use to my previous question: Montecarlo: Names are u11u16 u21u26 x; Generate = u11u16 u21u26 (1); Categorical = u11u16 u21u26 ; Genclasses = c1(2) c2(2); Classes = c1(2) c2(2) ; Nobservations = 300; Seed = 891107; Nrep = 500; Repsave = ALL; Save = sim1*.dat; Analysis: Type = Mixture; Starts = 0; UCELLSIZE = 0; ALGORITHM=INTEGRATION; PROCESSORS=4; Model Population: %Overall% [x@0]; x@1; c1#1 on x*.5; [c1#1*0]; !Regression of transitions c2#1 ON c1#1*2.5; ! c1#1 is normative Model c1: %c1#1% !Specifying the class specific item thresholds c2#1 ON x*.5; [u11$1*1 u12$1*1 u13$1*1 u14$1*1 u15$1*1 u16$1*1]; %c1#2% c2#1 ON x*5; [u11$1*1 u12$1*1 u13$1*1 u14$1*1 u15$1*1 u16$1*1]; Model c2: %c2#1% [u11$1*1 u12$1*1 u13$1*1 u14$1*1 u15$1*1 u16$1*1]; %c2#2% [u11$1*1 u12$1*1 u13$1*1 u14$1*1 u15$1*1 u16$1*1]; 


Posts to Mplus Discussion are limited to one window. Please send your question, files, and license number to support@statmodel.com. 

Ai Ye posted on Monday, February 22, 2016  6:40 pm



Hi, one question regarding simulation in Latent transition analysis. If I want to get simulated data for a simple LTA scenario: two classes across two time points. How could I control the entropy level if measurement quality is one of the conditions I want to simulate? I read in another discussion board that it is through trialanderror, but how so please? Also, in my model population, can I specify the transition probability of the simulated model, or the transitions supposed to be pretty random? Many thanks! 


Entropy is directly influenced by the separation of the means/thresholds between the classes. The transition probs are determined by the logit values you choose for c on c. See for instance web note 13. 

Ai Ye posted on Friday, February 26, 2016  1:32 pm



Thanks for your response. I am able to generate a simulated model with a entropy level of medium (around 0.6) and high (around 0.8), by modifying the separation of thresholds between classes as well as covarianace effect on the class membership and transition. But I spent an incredibly long time to figure out a problem and I could not: why in the "model" output, the 95% coverage of the covariance effect is not even close to 1, and pvalue is never significant no matter how large value I tried for the covariance coefficient? Thank you so very much! 


Please send the output to Support along with your license number. 


Hi, I am trying to run a MC simulation of a multinomial regression because I have a very small number of cases and 'd like to estimate the bias. Although the model on the real data converges and have no warning message, the simulation gives me a FATAL ERROR: Mplus VERSION 7.4 (Linux) MONTECARLO: NAMES = cb morratf ; GENERATE = cb (n 6); nominal = cb; NOBSERVATIONS = 27; NREPS = 1000; SEED = 4533; MODEL POPULATION: cb#1 ON morratf*2.16457; cb#2 ON morratf*1.62422; cb#3 ON morratf*0.05467; cb#4 ON morratf*1.77290; cb#5 ON morratf*0.11880; [ cb#1*178.59021 ]; [ cb#2*133.71619 ]; [ cb#3*40.33803 ]; [ cb#4*146.14532 ]; [ cb#5*90.68129 ]; MODEL: #same as population model## INPUT READING TERMINATED NORMALLY *** FATAL ERROR THE POPULATION COVARIANCE MATRIX THAT YOU GAVE AS INPUT IS NOT POSITIVE DEFINITE AS IT SHOULD BE. 


sorry it should have been: [ cb#1*178.59021 ]; [ cb#2*133.71619 ]; [ cb#3*4.33803 ]; [ cb#4*146.14532 ]; [ cb#5*9.68129 ]; however the result is the same 


You have to give a variance (and a mean if you want) for the morratf covariate in Model Population (not in Model). 

Xuan Chen posted on Tuesday, January 10, 2017  9:15 pm



Hello Linda, I checked the mcex7.6 for simulating threelevel categorical observed va riable. However, what I want to conduct is a twolevel CFA with 3level categorical indicators. I tried to put threshold into my model population and model. It sais only between level can be applied. Within level do not allow to do that. Is that correct just setting the between level? Here is what I coded£º[u1$1*1 u1$2*2 u2$1*1 u2$2*2 u3$1*1 u3$2*2 u4$1*1 u4$2*2]; Many Thanks 


Yes. 

Xuan Chen posted on Sunday, January 15, 2017  7:44 pm



Hello, I conducted a simulation to validate reliability of a questionaire using multilevel cfa analysis, like omega and H, which requires individual item variance at within level. But my item is ordinal 3level scale. My output said : *ERROR in MODEL and model population command Variances for categorical outcomes are not allowed on the within level. Variance given for: U1 Here is my formular for the computation of omega and H£º 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)))); numb=(bl1+bl2+bl3+bl4)**2; denomb=((bl1+bl2+bl3+bl4)**2)+(br1+br2+br3+br4); omegab=numb/denomb; hb=1/(1+(1/((bl1**2/br1)+(bl2**2/br2)+(bl3**2/br3)+(bl4**2/br4)))); Is there possible way to solve this? And do you have examples of monte carlo CFA simulation for 3level categorical variable. Thanks in advance. Xuan 


Perhaps you are saying that you have 2 levels and the ordinal item has 3 categories. If so, there are UG examples of this kind and every UG example has a Monte Carlo counterpart on our website  see the Users Guide section. Categorical variables don't have free withinlevel variance parameters. In the Delta parameterization of WLSMV and with ML they are fixed at 1. Note also that RaykovMarcoulides have written about reliability for categorical items. 

Xuan Chen posted on Monday, January 16, 2017  8:39 pm



Thanks so much for you kindly reply. Now I have corrected my codes and got what I want. However, the output includes so much information. From the UG, I found there are some instructions of the output like tech 1  tech16, which helps a lot. However, is there a real example to help understand the output or interpretations? I am conducting a twolevel CFA simulation study. Again thanks 


Our new book describes how to interpret Monte Carlo simulation output (in the case of mediation analysis). 

Fred posted on Wednesday, January 10, 2018  2:04 am



Hello, if I conduct a MCstudy with categorical indicators and one latent factor, Mplus uses WLSMV to generate the data, i.e.: MODEL POPULATION: f1@1; f1 BY y1y5@.7; y1y5@.51; You can see, that the error variance is 1(.7*.7). If I analyze the data with WLSMV the unstandardized solution matches the standardized one. If I analyze the data with ML they dont match, i.e. the unstandardized solution is different to the standardized one. Wherease I can apply the euqation to caclulate the errors for the stand. solution where the values add up to one (like intended) I cant do that for the unstand. solution. Now if I want to contniue analyzing the data with ML at which output do I need to look at? The unstandardized one although my residuals and loadings dont add up to one or the standardized one where it is the case? Thank you 


WLSMV in the default Delta parameterization sets the metric by the y* variance being 1 whereas WLSMV Theta parameteriation and ML parameterization with link=probit sets the metric by the residual variance being 1. 

Fred posted on Wednesday, January 10, 2018  10:53 pm



Which means if I analyze the data with ML i cannot compare the estimated variances (residuals, or any kind) to the population ones. Correct? But I am able to compare the factor loadings (and covariances) to the population parameters. Correct? Thank you for xour help 


If you want to analyze by ML you get results in the right metric if you generate by ML or generate by WLSMV in Theta parameterization. 

Xuan Chen posted on Thursday, May 10, 2018  11:40 am



Hi Dr. Muthen, Could you specify how the "Estimates Average" in MC simulation was calculated? Is it mean or median of the N replications? Thanks very much Xuan 


Mean. 

Back to top 