Random slopes for SEM?
Message/Author
 john posted on Sunday, December 05, 2004 - 1:00 pm
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 - 5:30 pm
Yes, this is possible.
 Eva  posted on Thursday, December 23, 2004 - 5:07 pm
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.
*************************************************

Eva
 Linda K. Muthen posted on Thursday, December 23, 2004 - 5:24 pm
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 - 11: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 - 2:05 pm
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 - 7: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 - 12:28 pm
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 - 11: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 - 6: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 - 1:20 pm
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 - 4:53 pm
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 - 6: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 Tuesday, January 22, 2013 - 2:10 am
 Mason G Haber posted on Tuesday, January 22, 2013 - 6: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 - 11: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 - 12:03 pm
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 - 12:17 pm
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 - 7: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 - 7: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 - 7: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 - 8: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 - 10: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 - 11: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 Friday, August 09, 2013 - 12:10 am
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 Friday, August 09, 2013 - 12:30 am
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 Friday, August 09, 2013 - 12:38 am
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 - 12:06 pm
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;

Jiayun
 Linda K. Muthen posted on Monday, August 12, 2013 - 3:45 pm
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 - 8: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 - 8:21 pm
 Bengt O. Muthen posted on Thursday, August 14, 2014 - 8: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.