Message/Author 

john posted on Sunday, December 05, 2004  7:00 am



I wonder if it is possible to model random slopes for level1 variables within Mplus multilevel SEM options when the data are crosssectional and the level2 variables do not represent level1 equivalents? Best, John 


Yes, this is possible. 

Eva posted on Thursday, December 23, 2004  11:07 am



Dear Dr. Muthen, am I right that here's a contradiction between the first and the two last statements? The first is quoted from your introduction on ML modelling, I found the other ones concerning ML SEM in this forum: ************************************************* 1. "The disaggregated multilevel models estimated by Mplus contain random intercepts but, except for growth models, not random slopes." ************************************************* 2. By john on Sunday, December 05, 2004  07:00 am: I wonder if it is possible to model random slopes for level1 variables within Mplus multilevel SEM options when the data are crosssectional and the level2 variables do not represent level1 equivalents? Best, John ************************************************* 3. By Linda K. Muthen on Sunday, December 05, 2004  11:30 am: Yes, this is possible. ************************************************* Many thanks in advance, Eva 


Things have changed in Mplus such that it is now possible to have random intercepts and random slopes. When the first post was made, only random intercepts were available except for growth models. 


Is it possible to model a random slope in TYPE=COMPLEX? There doesn't seem to be any examples of TYPE=COMPLEX examples in the manual. If it is possible to do, how would I write the syntax in the MODEL command if Y is regressed on X and I suspect that it has a random slope that is moderated by Z how? Thank you, 


No, we don't have examples of TYPE=COMPLEX because TYPE=COMPLEX can be added to most examples. If you look at the table under the ESTIMATOR option in the Mplus User's Guide, you can see which analysis types can be used together. You will see that COMPLEX and RANDOM can be used together. 


Dear professors, What is the difference between type=complex and type=random complex? And why are there less subjects included in the analyses in the type=random complex command? Thanks! 


TYPE=RANDOM is required when the model contains random effects defined using the  symbol. See Chapter 16 of the users' guide for more information. The difference in sample size is likely due to cases with missing on covariates being removed from the analysis with TYPE=RANDOM. With TYPE=GENERAL COMPLEX, this is not done because the results are the same if the model is estimated conditioned on the covariates or not. With TYPE=RANDOM, this is not the case. 


I am running a twolevel CFA. We are interested in examining how covariance/correlation between two withinlevel factors varies across the 2nd level units. I understand that we can run a random slope analysis where we regress one factor on the other but we would like to examine the betweenlevel variance of the covariance/correlation (as we don't assume that one factor has an effect on the other. Instead, we assume that they covary, and the strength of covariation/correlation might be different across the 2nd level units). Is there a way to do it? Thank you 


The only way I can think that you could look at covariances across clusters would be to use mixture modeling and a betweenlevel categorical latent variable where the classes consist of clusters. 


My question concerns the same data (twolevel CFA). Is it possible to save covariances/correlations between two factors for each 2nd level unit? Or, can I only save factor scores? In addition, what is saved under the name b_variable name and b_variable name_SE? Thank you again! 


No, the model is estimated assuming psi is equal across clusters. You can save only the factors scores. The two values you see are the between part of the latent variable decomposition of your observed variables that are not on the WITHIN or BETWEEN list and their standard errors. 

Lucy Morgan posted on Monday, January 21, 2013  12:26 pm



I am running a multilevel model using care assistant variables at level1 (N = 186) and manager variables at level 2 (N = 37). I am trying to add random slopes for level 1 variables and keep getting the following error message for CAIDIM, and CAIjG: SERIOUS PROBLEM IN THE OPTIMIZATION WHEN COMPUTING THE POSTERIOR DISTRIBUTION. CHANGE YOUR MODEL AND/OR STARTING VALUES. An example of my code is ANALYSIS: TYPE = TWOLEVEL RANDOM; ESTIMATOR IS ML; ALGORITHM = INTEGRATION; MODEL: %WITHIN% wealth BY S1_1 S1_5 S1_12 S1_14 S1_18; relat BY S1_2 S1_4 S1_13 S1_15 S1_19; fame BY S1_6 S1_8 S1_9 S1_11 S1_16; commun BY S1_3 S1_7 S1_10 S1_17 S1_20; S1_8 WITH S1_9; S1_6 WITH S1_11; S1_8 WITH S1_11; CA_Inter ON commun wealth relat fame CAExt2 CAIjG CAIjB; b1  CA_Inter ON CAIDIM; %BETWEEN% CA_Inter; b1; I have checked through the forum but cannot find any replies to the same problem, so I was wondering if you could help me as I *think* I have specified the model correctly but don't have a clue how to go about changing starting values! Many thanks Lucy 


Please send your output to support@statmodel.com, including Tech1 and Tech8. 


I'd like to examine both within and crosslevel effects in a two level longitudinal model in which there are several level 2 predictors, a level 1 predictor, and a level 1 covariate. I am familiar with example 9.2 in the M plus manual for estimating cross level effects. However, this example only models one crosslevel effect. Two issues, the first related to the example, and the second related to interpreting output when there are crosslevel effects: 1) In estimating crosslevel effects involving the Level 1 predictor (level 2 predictor * level 1 predictor), can you control for the crosslevel effect involving a level 1 covariate (level 2 predictor * level 1 covariate), rather than simply controlling for the level 1 effect of the covariate? 2) For some reason, the code for crosslevel effects seems to be incompatible with the code used for modeling level 1 effects. Is that because the code for the crosslevel effects automatically calculates level 1 effects (and thus, a statement to model level 1 effects would be redundant)? Also, where would I find statistics for the level 1 effects, since these do not seem to be included in the output when crosslevel effects are modeled? Would be the intecepts for the level 1 variables? MH 


1) Yes. You would define 2 random slopes. 2) If you say for example s  y on x; you cannot also say y on x;  the effect is either random or fixed. If this is not what you are asking in 2), please restate. For random slopes like s above, you find its mean and variance on level 2. If s is regressed on a level 2 variable, you get its intercepts and residual variances on level 2. 


Thank you for your response. To make sure that I understand re: #2, the statement "s  y on x" defines a random level 1 effect, and "y on x" in the level 1 (within) portion of the model statement defines a fixed level 1 effect, correct? To clarify, which coefficient in the output represents a random level 1 effect (the beta for a random effect of a level 1 variable)? MH 


s  y ON x; define a random effect. s is the random coefficient. Its mean and variance are found on the between level. y ON x; defines a fixed effect. See Example 9.1 and 9.2 in the user's guide for further information. 


Where can I find the mean and variance of slopes in a random coefficients model, and is the mean the appropriate representation of these level 1 effects? In other words, if I am interested in assessing the significance of a slope, where do I find this information? I appreciate your patience with my questions. MH 


The mean and variance of a random slope are found in the between part of the model. 


Examining the between level output, I see crosslevel coefficients, correlations, intercepts, and residual variances. I suppose you are speaking of the intercept and residual coefficients when you refer to the mean and variance (since the intercept would be the value of the slope at the average value of all grand mean centered level 2 variables?) Again, thank you for your patience. 


If you have regressed the mean and variance of the random coefficients on a covariate, then the model parameters are an intercept and residual variance. If this does not help, send the output and your license number to support@statmodel.com so I can see what you are looking at. 


1) Is it possible to have the random slope code (e.g., s1  m ON x) in the BETWEEN section of a twolevel model if x is a level2 variable? m is a level1 variable. But since x is at level2, it can have only betweenlevel effects; yet the effect of x on m can differ across level2 units, hence the random slopes. Is this plausible? 2) If the answer to #1 is YES, would the mean and variance of the s1 random slope also be defined in the BETWEEN section of the model? 3) Further, is this setup plausible if x is a dichotomous (dummy) variable? 


In a TWOLEVEL model, random slopes are specified in the within part of the model. They cannot be specified in the between part of the model. 


What if one of the variables in this random slope regression is a level2 variable? Wouldn't the entire effect then be on the BETWEEN level and not the WITHIN level? Can you clarify the reasoning for putting this code in the WITHIN section? 


The Mplus approach is in line with standard formulas for twolevel modeling. You write a level1 equation where some coefficients are designated as random and then on level2 they are variables (varying across level2 units) for which you can estimate variances and relationships. Same if you have a 3level situation. You can on level2 designate some coefficients as random and they are then variables on level3. It follows that if you designate a slope for a level2 predictor to be random you need to have a level3 on which that random slope varies. See the RaudenbushBryk 2002 book; this background should be active knowledge when using the more general multilevel modeling of Mplus. You won't see the R&B book showing a twolevel model with a level2 equation that has random coefficients. 


OK, thank you. This actually makes a lot of sense, particularly this point: "It follows that if you designate a slope for a level2 predictor to be random you need to have a level3 on which that random slope varies." That does make sense. 

JIAYUN JIN posted on Monday, August 12, 2013  6:06 am



Hi! I am running a two level model for count outcome, but when I add random slopes for four level1 variables, mplus takes a lot of time. I have tried to add them one by one to see if they are significant, and they are. my command is below: VARIABLE: NAMES ARE resid intnum intage intgdr resage resgdr resedu resint nopin; USEVARIABLES ARE intnum resage resgdr resedu resint nopin; WITHIN = resage resgdr resedu resint; CLUSTER = intnum; COUNT IS nopin; ANALYSIS: TYPE = twolevel random; ALGORITHM = INTEGRATION; INTEGRATION=MONTECARLO(5000); MODEL: %WITHIN% randoms1nopin ON resage; randoms2nopin ON resgdr; randoms3nopin ON resedu; randoms4nopin ON resint; %BETWEEN% nopin; would you please help me to see what is the problem? thank you so much! Jiayun 


Your model has five dimensions of integration. If your computer has multiple processors, you can speed up the analysis by using the PROCESSORS option, for example, PROCESSORS= 4; 


Greetings, I am estimating a 3level model with latent aggregation of manifest variables (i.e. all my variables are observed, measured at L1, and I use latent aggregation to bring that up to L2 and L3). I want to test if a Level 3 predictor has an impact on the slopes of L1 and L2 regressions (i.e. random slopes) but for some reason cannot use random slopes for similar effects modelled at both L1 and L2... For example: %within% s1  x on y; %between L2% s2  x on y; %between L3% s1; s2; [s1]; [s2]; s1 on w; s2 on w; It also seems that I cannot have y and x only at 2 levels and need to model their variances at L3. Also, for some reasons, the model does not work when I have missing values on y. 


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


These restrictions are correct except the one about specifying variables on level 1 and 2 only. You have to use the command within = (cluster1) Y X; You can use observed aggregation for the covariate. 


Dear Drs. Muthén, we are trying to estimate a multilevel mediation model with random slopes. We analyze weekly survey data, which includes a lot of missing values due to dropout. As long as we do not include random slopes, we obtain results without any problems. When adding the random slopes, an error message occurs proposing to add ALGORITHM = INTEGRATION; INTEGRATION = MONTECARLO (500) in the analysis part of the code. After changing the code, we obtain the following error message: THE ESTIMATED BETWEEN COVARIANCE MATRIX COULD NOT BE INVERTED. COMPUTATION COULD NOT BE COMPLETED IN ITERATION 89. CHANGE YOUR MODEL AND/OR STARTING VALUES. THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ERROR IN THE COMPUTATION. CHANGE YOUR MODEL AND/OR STARTING VALUES. Did we do something wrong? Are there any mistakes in our code? Thanks a lot! 


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

Back to top 