Random slopes for SEM? PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 john posted on Sunday, December 05, 2004 - 7:00 am
I wonder if it is possible to model random slopes for level-1 variables within Mplus multilevel SEM options when the data are cross-sectional and the level-2 variables do not represent level-1 equivalents?
Best, John
 Linda K. Muthen posted on Sunday, December 05, 2004 - 11:30 am
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 level-1 variables within Mplus multilevel SEM options when the data are cross-sectional and the level-2 variables do not represent level-1 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
 Linda K. Muthen posted on Thursday, December 23, 2004 - 11:24 am
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.
 Scott Colwell, PhD posted on Tuesday, January 17, 2006 - 5:53 am
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,
 Linda K. Muthen posted on Tuesday, January 17, 2006 - 8:05 am
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.
 Carmen van der Zwaluw posted on Friday, December 05, 2008 - 1:27 am
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!
 Linda K. Muthen posted on Friday, December 05, 2008 - 6:28 am
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.
 Kätlin Peets posted on Tuesday, July 27, 2010 - 5:34 am
I am running a two-level CFA. We are interested in examining how covariance/correlation between two within-level 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 between-level 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
 Linda K. Muthen posted on Tuesday, July 27, 2010 - 12:26 pm
The only way I can think that you could look at covariances across clusters would be to use mixture modeling and a between-level categorical latent variable where the classes consist of clusters.
 Kätlin Peets posted on Wednesday, July 28, 2010 - 7:20 am
My question concerns the same data (two-level 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!
 Linda K. Muthen posted on Wednesday, July 28, 2010 - 10:53 am
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
 Bengt O. Muthen posted on Monday, January 21, 2013 - 8:10 pm
Please send your output to support@statmodel.com, including Tech1 and Tech8.
 Mason G Haber posted on Tuesday, January 22, 2013 - 12:55 pm
I'd like to examine both within and cross-level 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 cross-level effect. Two issues, the first related to the example, and the second related to interpreting output when there are cross-level effects:

1) In estimating cross-level effects involving the Level 1 predictor (level 2 predictor * level 1 predictor), can you control for the cross-level 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 cross-level effects seems to be incompatible with the code used for modeling level 1 effects. Is that because the code for the cross-level 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 cross-level effects are modeled? Would be the intecepts for the level 1 variables?

-MH
 Bengt O. Muthen posted on Tuesday, January 22, 2013 - 5:16 pm
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 re-state.

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.
 Mason G Haber posted on Thursday, January 24, 2013 - 6:03 am
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
 Linda K. Muthen posted on Thursday, January 24, 2013 - 6:17 am
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.
 Mason G Haber posted on Thursday, January 31, 2013 - 1:08 pm
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
 Linda K. Muthen posted on Thursday, January 31, 2013 - 1:39 pm
The mean and variance of a random slope are found in the between part of the model.
 Mason G Haber posted on Thursday, January 31, 2013 - 1:48 pm
Examining the between level output, I see cross-level 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.
 Linda K. Muthen posted on Thursday, January 31, 2013 - 2:08 pm
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.
 Lisa M. Yarnell posted on Thursday, August 08, 2013 - 4:42 pm
1) Is it possible to have the random slope code (e.g., s1 | m ON x) in the BETWEEN section of a two-level model if x is a level-2 variable?

m is a level-1 variable. But since x is at level-2, it can have only between-level effects; yet the effect of x on m can differ across level-2 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?
 Linda K. Muthen posted on Thursday, August 08, 2013 - 5:45 pm
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.
 Lisa M. Yarnell posted on Thursday, August 08, 2013 - 6:10 pm
What if one of the variables in this random slope regression is a level-2 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?
 Bengt O. Muthen posted on Thursday, August 08, 2013 - 6:30 pm
The Mplus approach is in line with standard formulas for twolevel modeling. You write a level-1 equation where some coefficients are designated as random and then on level-2 they are variables (varying across level-2 units) for which you can estimate variances and relationships. Same if you have a 3-level situation. You can on level-2 designate some coefficients as random and they are then variables on level-3.

It follows that if you designate a slope for a level-2 predictor to be random you need to have a level-3 on which that random slope varies.

See the Raudenbush-Bryk 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 two-level model with a level-2 equation that has random coefficients.
 Lisa M. Yarnell posted on Thursday, August 08, 2013 - 6:38 pm
OK, thank you. This actually makes a lot of sense, particularly this point:
"It follows that if you designate a slope for a level-2 predictor to be random you need to have a level-3 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 level-1 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%
randoms1|nopin ON resage;
randoms2|nopin ON resgdr;
randoms3|nopin ON resedu;
randoms4|nopin ON resint;


%BETWEEN%
nopin;

would you please help me to see what is the problem? thank you so much!

Jiayun
 Linda K. Muthen posted on Monday, August 12, 2013 - 9:45 am
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;
 Alexandre J.S. Morin posted on Wednesday, August 13, 2014 - 2:45 am
Greetings,
I am estimating a 3-level 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.
 Linda K. Muthen posted on Wednesday, August 13, 2014 - 2:21 pm
Please send the output and your license number to support@statmodel.com.
 Bengt O. Muthen posted on Thursday, August 14, 2014 - 2:41 pm
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.
 Heiko Breitsohl posted on Tuesday, September 12, 2017 - 11:34 am
Dear Drs. Muthén,

we are trying to estimate a multi-level 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!
 Bengt O. Muthen posted on Tuesday, September 12, 2017 - 6:26 pm
Please send your output to Support along with your license number.
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: