Message/Author 


How do I specify a binary covariate in a Monte Carlo simulation that does not have a 50/50 split, but instead, for example, a 75/25 split? 


You use the CUTPOINT option of the MONTECARLO command. See Example 11.1 in the Mplus User's Guide. The value given is a zscore. So you use a zscore table to select the value that corresponds to a 75/25 split. 

June Zhou posted on Thursday, February 07, 2013  3:17 pm



I have a similar question about generating a binary independent variable in a Monte Carlo simulation. I'd like to generate "Gender" variable that with population mean of 0.5 and variance of 0.25. What code should I use? Thank you in advance. 


The continuous variable you generate should have mean zero and variance 1. You should use a cutpoint of zero which cuts the sample 50/50 with a variance of .25. 

Jamie Stagl posted on Wednesday, February 12, 2014  10:49 am



Hello, I am doing a Monte Carlo simulation of a growth model with 3 time points and a nominal predictor (3 intervention groups). I specified 2 binary dummy variables (x2 and x3) to represent my 3 groups. What CUTPOINT value should I use for these 2 dummy variables, considering they are not a 50/50 split (1/3 of sample gets intervention A, 1/3 gets intervention B, and 1/3 gets intervention C)? Thank you. 


If you specify mean and variance = 0, 1 for the variable that you apply Cutpoints to, you can use a table for a standard normal distribution function to get the cutpoints. For an example, see 12.1. 

Jamie Stagl posted on Sunday, February 16, 2014  9:06 pm



Thank you, that was very helpful. In general, we expect to see that 2 of the 3 groups do not change over the 3 time points, while the third group improves on the outcome. Would you say that the use of 2 dummy variables is an accurate way to estimate the necessary sample size (does the simulation know there are 3 linked groups with these 2 dummy variables or is it only doing a 2group comparison)? On a related note, would you suggest setting the slope growth factors at different values to reflect our hypothesis, and reference the power associated with the smaller parameter estimate to determine sample size? 


Actually, you are better off doing a multiplegroup analysis with 3 groups, where you control the number of observations in the groups and have freedom to vary any parameter across the groups. So don't use dummy variables. Your hypothesis sounds like you would have the slope mean at zero in two of the groups. 

Tao Yang posted on Monday, January 23, 2017  10:58 pm



Hello, I'd like to run Monte Carlo power analysis of the interactions of x (binary predictor) with z and w (continuous variables). I generated data sets for x, z, w, and y to be used for external Monte Carlo in Mplus (so that I can create interaction terms using DEFINE). Syntax below. Without "MODEL: y ON x", I got an error message that "Only xvariables may have cutpoints in this type of analysis..." So I included MODEL command line only to tell the program to treat x as an exogenous variable. Does the MODEL command influence data generation? In other words, are data sets generated based on specifications in MODEL POPULATION or MODEL? MONTECARLO: NAMES = x z w y; NOBSERVATIONS = 500; CUTPOINTS = x(0); NREPS = 100;REPSAVE = ALL; SAVE = rep*.dat; ANALYSIS: TYPE = RANDOM; MODEL POPULATION: zb BY z@1; zb@.50; z@.01; wb BY w@1; wb@.30; w@.01; xzb  zb XWITH x; xwb  wb XWITH x; y ON x*.20 zb*.10 wb*.30 xzb*.21 xwb*.35; [x@.50 zb@0 wb@0 z*.35 w*.12]; x@.25; [y*.12]; y*.02; MODEL: y ON x; 


Answered elsewhere. 

Yue Yin posted on Thursday, June 07, 2018  8:23 am



Hi, I am doing a Monte Carlo simulation analysis, for one variable for example "age", I want to divide the age into three groups, each group can generate the age like 34 and 56 years old. In other words, I want to make the range of age falls within 3 to 6. Should I model the cutpoints= age(3)  age(5)  age (6) with the mean of 4.5 and standard deviation of 0.5? 


To create several categories from a continuous variable you should use the Cut option in the Define command. In a Montecarlo simulation context, you approach this in 2 steps. See UG ex12.6 Step 1 and Step 2. The "internal montecarlo" step 1 generates the continuous variable and the "external montecarlo" step 2 can use Define to cut it up in categories. 

Yue Yin posted on Tuesday, June 12, 2018  12:25 pm



Hi, It turns out I'd better to use the Montecarlo multiple groups to do the analysis. My intention was to use three groups, each groups will have different normal distribution for "age" variable. But when I tried to use the multiple group in the Monte carlo, the error says the multiple group does not support ALGORITHM=INTEGRATION, and I should try the Ngroups option type=mixture. And I tried it, I specified %overall% Age@.0289; [Age@1]; Fac by y1y6*.8; Fac@1; Fac@.19; [y1$1*1.25 y2$1*.75 y3$1*.25 y4$1*.25 y5$1*.75 y6$1*1.25]; Fac on Age*.9; %g#2% Age@.0289; [Age@0]; %g#3% Age@.0289; [Age@1]; But error says the true value should be specified in the overall model. But in this case, the range for the "age" is the same for three groups. How should I specify different distributions for three groups here? 


We need to see the full output  send to Support along with your license number. 

Yue Yin posted on Thursday, June 14, 2018  11:32 am



Hi, Before I send the output can I ask one more question? The "cutpoints" uses to create the binary independent variable (0,1), what if I want to create a independent variable more than 2 categories? For example, I want to create a three categories independent variable (1, 0, 1), how should I do it? The method you told me can cut continuous variable into categories, but in this case I only want (1, 0, 1), it is kind of uniform distribution. Is there a way to do it? Thank you so much. 


Do you want a nominal or ordinal variable? 

Yue Yin posted on Thursday, June 14, 2018  7:01 pm



I want ordinal variable, currently it is three categories. But I can't use "categorical" or "generate" since it is a covariate variable or independent variable. And I want use it to set the missingness equation, so the external monte carlo and then internal monte carlo cannot be used here. Thanks. 


Maybe UG ex 12.1 is of use to you. 

Yue Yin posted on Thursday, June 21, 2018  7:18 am



Yeah, but UG ex 12.1 divided the covariate into two groups, I want to divide into three groups, how should I do it? 


I was thinking of the use of PATMISS in that example because you mentioned setting missingness. 

Back to top 