Montecarlo simulation PreviousNext
Mplus Discussion > Categorical Data Modeling >
Message/Author
 Anonymous posted on Wednesday, September 01, 2004 - 12:01 pm
C:\MPLUS\3.0>mplus.exe d1.inp

Mplus VERSION 3.01
MUTHEN & MUTHEN

I get the following error message when trying to do montecarlo simulation. I had to run it in a DOS window to see the error message.


Running input file 'D1.INP'...

forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
Mplus.exe 00D0E397 Unknown Unknown Unknown

C:\MPLUS\3.0>

Mplus VERSION 3.01
MUTHEN & MUTHEN
09/01/2004 1:48 PM

INPUT INSTRUCTIONS

TITLE: MG montecarlo
MONTECARLO:
Names are y1-y7;
NOBSERVATIONS = 500 500;
NREPS = 10;
NGROUPS = 2;
CUTPOINTS = Y1-Y7(3) |Y1-Y7(3) ;
CATEGORICAL ARE Y1-Y7;

MODEL POPULATION:
ETA BY Y1-Y7@.8;
ETA@1;
[ETA@0];
Y1-Y7@.36;
[Y1$1@-1 Y1$2@0 Y1$3@1.5];
[Y2$1@-1 Y2$2@0 Y2$3@1.5];
[Y3$1@-1 Y3$2@0 Y3$3@1.5];
[Y4$1@-1 Y4$2@0 Y4$3@1.5];
[Y5$1@-1 Y5$2@0 Y5$3@1.5];
[Y6$1@-1 Y6$2@0 Y6$3@1.5];
[Y7$1@-1 Y7$2@0 Y7$3@1.5];
MODEL G2:
ETA@2.25;
[ETA@.5];
ETA BY Y5@.7;
Y4@.49;
[Y6$1@-1.25 Y6$1.75@0 Y6$3@1.25];
[Y7$2@1.5];
ANALYSIS:
TYPE IS MEANSTRUCTURE;
PARAMETERIZATION =THETA;
! ESTIMATOR = WLSMV;
MODEL:
ETA BY Y1-Y7*.8;
ETA@1;
[ETA@0];
Y1-Y7@.36;
[Y1$1@-1 Y1$2@0 Y1$3@1.5];
[Y2$1@-1 Y2$2@0 Y2$3@1.5];
[Y3$1@-1 Y3$2@0 Y3$3@1.5];
[Y4$1@-1 Y4$2@0 Y4$3@1.5];
[Y5$1@-1 Y5$2@0 Y5$3@1.5];
[Y6$1@-1 Y6$2@0 Y6$3@1.5];
[Y7$1@-1 Y7$2@0 Y7$3@1.5];
MODEL G2:
ETA BY Y5*.7;
Y4*.49;
[Y6$1@-1.25 Y6$1.75@0 Y6$3@1.25];
[Y7$2@1.5];
OUTPUT: ;
 Linda K. Muthen posted on Wednesday, September 01, 2004 - 12:15 pm
You are generating variables as continuous and analyzing them as categorical. This cannot be done. The latest update will give an error message in this situation. It will be available today or tomorrow. Please don't paste output in Mplus Discussion as it may be large. Instead send the problem to support@statmodel.com.
 Anonymous posted on Saturday, September 18, 2004 - 6:55 pm
When analyzing montecarlo results,
Can the standardized parameter values be saved? It seems that the SAVEDATA command only saves the unstandardized parameters.
 Linda K. Muthen posted on Wednesday, September 29, 2004 - 4:31 pm
No, the standardized values cannot be saved.
 Anonymous posted on Wednesday, October 13, 2004 - 12:23 pm
Given that the simulation procedure reports unstandarized parameters --Would it be possible to calculate the standardized parameters from the available information?
 Linda K. Muthen posted on Thursday, October 14, 2004 - 10:32 am
You can do this using the estimated parameters. The formulas can be found in Appendix 3. The technical appendices can be found on the website.
 Daniel posted on Wednesday, December 15, 2004 - 8:35 am
Hi Linda and Bengt,
I'm having trouble running a simulation with three associated processes, two of which are continuous and one categorical. Is there something special I should know about this type of analysis?
 Linda K. Muthen posted on Wednesday, December 15, 2004 - 9:00 am
Not really. It's a combination of Example 6.13 without the ON statements and Example 6.4. Look at the Monte Carlo counterparts for these examples that come with Version 3 as a guide.
 daniel posted on Wednesday, December 15, 2004 - 9:17 am
I'm sending the code by email, if you don't mind reviewing it, as I am still getting errors.
 Linda K. Muthen posted on Wednesday, December 15, 2004 - 10:01 am
The output you sent does not show any errors. What do you think the problem is?
 Daniel posted on Wednesday, December 15, 2004 - 10:38 am
I get zero completed runs, even with 120+ repetitions requested.
 Daniel posted on Thursday, December 16, 2004 - 10:44 am
Hi Linda, I wonder if you had a chance to see my latest response. I ran the model with 120 - 1000 repetitions, and it returns to me each time without errors, but with zero completed runs.
 Linda K. Muthen posted on Thursday, December 16, 2004 - 1:12 pm
Sorry. I haven't had time to take a close. I think that the problem is the population values that you have chosen result in no variance for the smoke varialbes, that is, all observations end up in one category. Where do the population values for the thresholds, for example, come from?
 Daniel posted on Friday, December 17, 2004 - 4:49 am
I'll take a look at it again. I didn't change my population values to reflect the categorical nature of the variable. I ran this model first with all continuous variables. Then, I added thresholds values in a simple increasing (1,2,3) pattern, just to see if this model would work. In other words, I didn't take much effort into generating the values. I'll try again with better population values to see if it runs.
 Daniel posted on Friday, December 17, 2004 - 5:06 am
Linda,
I ran single process models for smoking (categorical) and BMI (continuous), and each ran fine. However, when I combined the categorical and continuous processes, I did not get any completions. So, I must be doing something wrong when I combine the two types.
 Linda K. Muthen posted on Friday, December 17, 2004 - 8:12 am
With extreme thresholds of 2 and 3, when you combine the continuous and categorical outcomes, the correlations between continuous and categorical outcomes likely become hard to estimate. Use threshold values that are based on theory or real data and you should be fine. Remember that thresholds are z-scores. So a value of 3 would result in .13 percent in a category. With 1000 observations, this is about one individual.
 Daniel posted on Friday, December 17, 2004 - 8:34 am
Thank you very much, I'll try it
 alexandra posted on Tuesday, February 22, 2005 - 3:47 am
Hello,

I want to make a Montecarlo study with categorical variables but I don't know how to fix the paramters of the population's model. Indeed, I know the population's proportions so I am able to fix the thresholds but I don't know how to fix the path's coefficient, I would like there value to be meaningful and realistic but I only know the poluation probabilities.
 Linda K. Muthen posted on Saturday, February 26, 2005 - 5:02 pm
I assume that you know the proportions because you have data that you have analyzed and have obtained the proportions from the data. See Example 11.7 in the Mplus User's Guide. Here real data are analyzed to obtain population parameter values for a Monte Carlo study. This may be helpful to you.
 Jon Elhai posted on Monday, October 06, 2008 - 8:18 am
I've been a bit unclear about what estimates to provide in a Monte Carlo study to estimate sample size and power. I seem to think that I should provide the unstandardized parameter estimates? But many of the Mplus Monte Carlo input files seem to center the predictor variables, making me think that standardized estimates would be okay.
 Linda K. Muthen posted on Monday, October 06, 2008 - 8:33 am
You should use the unstandardized values.
 Yo In'nami posted on Sunday, May 29, 2011 - 2:10 am
Regarding your comment right above, what would be the consequences of using standardized, not unstandardized, parameter estimates in conducting a Monte Carlo simulation study to determine power and sample size? Would we get overestimated or underestimated power values? I haven't been able to find references on this issue.

I am conducting power analyses on published SEM models, where authors reported standardized estimates only and rarely reported unstandardized ones except for multigroup analyses.
 Linda K. Muthen posted on Sunday, May 29, 2011 - 9:07 am
You would have to use MODEL CONSTRAINT to compute the standardized coefficients. Then the power would be correct. You can only get power for a parameter that is estimated. Standardized parameters are computed after model estimation unless you use MODEL CONSTRAINT.

You could consider doing a Monte Carlo study where all variables have variance one and use the standardized coefficients from the study as population parameter values. This would probably be close enough.
 ic8 posted on Monday, February 20, 2012 - 10:51 am
Hello Drs Muthen,

I'm having difficulty generating a categorical variable with a frequency distribution of my choosing. For example, I'd like to create a categorical variable with 5 levels, where the probabilities of levels 1,2,3,4,5 being "selected" are .2,.3,.1,.35,.05 (or really anything to this effect, the numbers I just listed were chosen arbitrarily). What I currently have is
montecarlo:
names=v6-v8;
generate=v6-v8(4);
categorical=v6-v8;
where I would then (in model population) have to specify the thresholds for each of the levels.
For example:
[v6$1@somenumber v6$2@someothernumber v6$3@etc v6$4@etcetc];
I read in the Mplus user's guide that the data for categorical variables might be generated via a logistic model, so I tried converting my probabilities to that. I haven't been able to get that to work because I don't know the parameters of the underlying distribution from which the variables are generated. Do I need to specify the parameters of this logistic cdf, or have I made an error somewhere else along the way?
 Linda K. Muthen posted on Tuesday, February 21, 2012 - 1:48 pm
The default is WLSMV. Use variances of one and take the threshold values from a z-table.
 Daniel Lee posted on Tuesday, October 13, 2020 - 11:32 am
Hello,

I am trying to run a MC simulation (to estimate power) for a simple logistic regression. From the user guide, I get how to specify my DV has categorical with 1 threshold (binary). However, I am not sure how to specify that 10% of the outcome is 1, while 90% of the outcome is 0.

If I understand correctly, the "cutpoints" statement is for IVs, and not DVs. Would I specify the low rate of the outcome (only 10% exposed) by specifying the mean (np) and variance (np(1-p)) under the model population and model command? In essence, I am trying to figure out a way to tell Mplus that the proportion of those exposed to the DV is 10%.

Thank you!
 Bengt O. Muthen posted on Tuesday, October 13, 2020 - 3:06 pm
You choose threshold values to make that happen. But there is no explicit formula. Instead, use trial and error on a very large sample and several replications.
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: