Cross-level and between-group interac... PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 Oli Christ posted on Thursday, August 25, 2005 - 3:15 am
I have a multi-level example where I expect the relationship between two individual-level variables to be moderated by a group-level variable (one that varies only between-groups). Can I test this hypothesis using M-Plus? The handbook seems to suggest that currently M-Plus cannot handle cross-level interactions. However, I would like to take advantage of M-Plus's group-mean centering options to decide whether I am dealing with a cross-level interaction or a between-group interaction.
 Linda K. Muthen posted on Thursday, August 25, 2005 - 8:56 am
I think you will get the results you want by the following partial setup:

WTIHIN = x;
BETWEEN = w;
MODEL:
%WITHIN%
s | y ON x;
%BETWEEN%
s ON w;
 Christian Geiser posted on Friday, June 16, 2006 - 2:42 am
I would like to estimate a path model with manifest variables in which a variable that varies within as well as between clusters (i.e., intelligence) is regressed on intelligence measured at an earlier time point and several other variables that vary ONLY between clusters (school classes) but are constant within clusters (i.e., variables such as class climate etc.). Furthermore, several of these cluster-level variables are supposed to be connected to other cluster level variables via regression or covariance paths. I am not sure if and how such a model can be specified in Mplus? It would be great if you could provide an appropriate example input code. Thank you very much.
 Bengt O. Muthen posted on Friday, June 16, 2006 - 8:06 am
Here is an example. Note that on the between level, y1 and y2 are the between parts of intelligence.

Between = w1 w2 w3;

Model:

%within%

y2 on y1;

%between%

y2 on y1 w1-w3;
w3 on w2;
w2 on w1;
 Andrew Dwyer posted on Thursday, June 29, 2006 - 4:56 pm
I have a multi-level analysis in which I have between-level dependent variable that needs to be regressed on a few within-level predictor variables, as well as a few between-level predictor variables (all variables are manifest variables). I'm not sure if the MPlus code that I am currently using is correct, so could you possibly give me an example of the setup file that could handle this analysis?
 Bengt O. Muthen posted on Sunday, July 02, 2006 - 5:16 am
I think you mean that you want to regress a between-level variable on the between part of a within-level variable. This can be done by not putting the variable on the WITHIN list. See Chapter 9 for multilevel examples.
 jan posted on Thursday, March 08, 2007 - 10:57 am
I'm new to multilevel modeling and maybe my question is simple, but I didn't find the answer, yet.

I need to predict an individual-level variable (self-concept) by another individual-level variable (achievement) as well as by the aggregated level of the latter one (class achievement). Doing the following is wrong, of course, because then I'll have a between level self-concept.

%within%
self ON achiev;
%between%
self ON achiev;

What I need is something like:
self ON indiv_achiev class_achiev

So, I'm wondering how to perform this in Mplus.

Thank you very much.
 Bengt O. Muthen posted on Thursday, March 08, 2007 - 11:21 am
The standard multilevel approach is to say that the influence of class-level achievement on self-concept is through the class-level part of self-concept (the class-level part of self-concept is of course a part of the student's self-concept score). The class-level part of self-concept is the random intercept of students' self-concept regressed on achievement. In other words, your Mplus setup is correct.
 jan posted on Thursday, March 08, 2007 - 12:44 pm
Dear Mr. Muthen,
thanks for your quick answer. I understand your point, but I don't think that it solves my problem.
I want to research the big-fish-little-pond-effect, which supposes that students' individual self-concept correlates positiv with their individual achievement and negativ with class-average achievement. Several studies found this effect using HLM-Models with class-average achievement as a level-2 predictor and individual achievement as a level-1 predictor for students' self-concept both times on level-1, I think (e.g. Lüdtke et al. 2005 in Contemporary Educational Psy; Marsh et al. 2000 in JPSP).
I am not dealing with HLM but with Mplus, so I hope to find this effect using Mplus. Maybe I made a big error in reasoning, but I'm still looking for the solution. A misunderstanding in my first message might have been that I talked about aggregated class achievement and not class-average achievement.
I would be very grateful for another idea.
 Bengt O. Muthen posted on Thursday, March 08, 2007 - 4:18 pm
Let's see if we can understand each other more fully. In the HLM model references you refer to, I would guess that they do what corresponds to the random intercept model in Mplus:

%within%
self ON achiev;
%between%
self ON achiev;

- except that their between-level covariate is aggregated class achievement rather than the latent variable score that Mplus produces (the difference is probably not large) - and you can do that in Mplus. You can have a positive beta on within and a negative beta on between.

But are you saying that you don't find this HLM-type approach sufficient?
 jan posted on Friday, March 09, 2007 - 3:41 am
I find this HLM approach sufficient. I just wanted to say, that I've no access to the HLM-software, but I'd like to find the bflpe (see my prior message) in my data using Mplus.

So, what Marsh et al. did is the following:
self = b0 + b1*achiev_ind + r (level 1)
b0 = g00 + g01*achiev_class + u0 (level 2)
b1 = g10 + g11*achiev_class + u1 (level 2)

I think this in your short course (day 5) on slide 24 ff. So I tried the following in Mplus:
%within%
s | self ON achiev;
%between%
self s ON ach_class;
self with s;

Doing this, I get following error message:

...PROBLEM INVOLVING VARIABLE SELF. THE RESIDUAL CORRELATION BETWEEN S AND SELF IS -1.001

Am I - aside from the error message - on the right track, now? Should I fix the variance of s with self to 0 (I'm not familiar with fixing variances)? Doing this, I get another error:

... THE VARIANCE OF S APPROACHES 0. FIX THIS VARIANCE AND THE CORRESPONDING COVARIANCES TO 0, DECREASE THE MINIMUM VARIANCE, OR SPECIFY THE VARIABLE AS A WITHIN VARIABLE.
 Boliang Guo posted on Friday, March 09, 2007 - 3:55 am
self with S mean the corelation of intercept of self with slop, do you wanna know this correaltion?
for higher corelation between slop and slop, we always center X before run the model, try center X to see what will happen
well, since veriance of S approach 0(not statistically significant?), it means the slop is not random among level 2 units, if yes, you should run a random intercept only model if the intercept is random, if level 2 variance of self is also not statistically significant, then, just run an OLS regression.
 Bengt O. Muthen posted on Friday, March 09, 2007 - 6:24 am
I would try a random intercept only model first, so get rid of the random slope. This means using the input

%within%
self ON achiev;
%between%
self ON ach_class;
 jan posted on Monday, March 12, 2007 - 3:13 am
Thanks again, this worked - even though I didn't get different directions for the two beta.
 Seung Bin Cho posted on Monday, May 21, 2007 - 1:09 pm
I'm posting my question here since it's closely related with questions posted on this thread.

I have a set of HLM equations that I want to run with Mplus.
It's a 3-level growth model(time points ?individual ?classroom)
Level 1: Yijt = P0ij + P1ij*Time + eijt
Level 2: P0ij = B00j + B01j*HRisk + r0ij
P1ij = B10j + B11j*HRisk + r 1ij
Level 3: B00j = G000 + G001*ECredit + u00j
B01j = G010 + G011*ECredit + u01j
B10j = G100 + G101*ECredit + u01j
B11j = G111 + G111*ECredit + u11j

continued on the next post...
 Seung Bin Cho posted on Monday, May 21, 2007 - 1:12 pm
My model statement is as follow:
model:
%within%
iw sw| selfc@0 selfc2@1 selfc3@2 selfc4@3;
selfc selfc2 selfc3 selfc4 (1);
b01| iw on HRisk;
b11| sw on HRisk;
%between%
ib sb| selfc@0 selfc2@1 selfc3@2 selfc4@3;
ib sb on ECredit;
b01 on ECredit;
b11 on ECredit;
selfc@0 selfc2@0 selfc3@0 selfc4@0;

I put the | statements to estimate the cross-level interactions.
I wonder if it's correct code. I looked at the examples in the manual, but it was not clear that I need | statements.
Thank you for any help.
 Linda K. Muthen posted on Monday, May 21, 2007 - 5:47 pm
This looks correct. Please keep posts within the size limitation.
 Dan Feaster posted on Wednesday, May 14, 2008 - 10:18 am
I am trying to estimate a cross-level interaction with a latent variable score for the X variable at level 2(i.e. my X variable is defined at both within and between):
%within%
rshas| pstmd_1 ON has_1;

%between%
pstmd_1 rhas ON has_1;
rhas=0;
Whether I free the random coefficient's variance or not I get errors like:
"THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO A NON-ZERO DERIVATIVE OF THE OBSERVED-DATA LOGLIKELIHOOD." OR "THE LOGLIKELIHOOD DECREASED IN THE LAST EM ITERATION."
Is this just 1)numerical problem with my data or 2) is this not possible in Mplus, at this time or 3) theoretically not possible (and I need to dig into the algorithm more)? I have no problem if I make this the calculated between-level variable at level 2.
 Linda K. Muthen posted on Wednesday, May 14, 2008 - 11:03 am
Given the information that you provide, it sounds like it is something specific to your data and the model. Please send your input, data, output, and license number to support@statmodel.com so we can see the full picture.
 chris lo posted on Tuesday, July 08, 2008 - 9:23 am
I have repeated measurements over time (e.g., depression scores and pain scores) for a group of individuals. I also have some variables which were measured only once at study entry (e.g., personality trait scores and gender).

I am running a multilevel model in which I am predicting the depression scores based on time and pain (level 1 variables). I have also entered the personality trait and gender variables as predictors (level 2 variables). My question concerns the specification of cross-level interactions. Does a level 1 (repeated) variable have to be set as a random effect before I can enter in an interaction involving it and a level 2 variable?

Thank you for any help with this.
 Linda K. Muthen posted on Tuesday, July 08, 2008 - 10:12 am
Yes, this is how it is done. See Example 9.2.
 M Hamd posted on Thursday, April 01, 2010 - 5:06 pm
I am trying to explore cross-level effects. Here is the case: x leads to y (at level 1)
x leads to M which leads to y (at level 2)
M also moderates the relation between "x and y" at level 1. Is the following code correct?

BETWEEN = M;
MODEL:
%WITHIN%
s | y ON x;
%BETWEEN%
M on x;
s Y ON M;
 Linda K. Muthen posted on Thursday, April 01, 2010 - 5:40 pm
Cross-level interactions are obtained using a random slope model like the one you have specified. See Example 9.2 for further information and Slide 45 of the Topic 7 course handout.
 Artur Pokropek posted on Friday, September 10, 2010 - 5:25 am
Hallo,

I've question about between level interaction. Suppose I'v got simple multilevel path model with random intercept:

WITHIN ARE w x*z;

%WITHIN%
y on x z x*z;
x z on w;

where x*z is interaction term.
I want to replicate this structure on between level. To have:

%BETWEEN%
y on x z x*z;

the problem is that I could not use XWITH option to specify interaction x*z on between level because x and z are not seeing as latent variables. Should I prepare aggregate variable with is interaction between clusters means of x and z or is it possible to do it in Mplus directly in the model?

Best regards
Artur
 Linda K. Muthen posted on Friday, September 10, 2010 - 9:38 am
Do you want a cross-level interaction of a within variable x with a between variable z or do you want to create an interaction term to use on the between level.
 Artur Pokropek posted on Friday, September 10, 2010 - 9:44 am
The second option. I want to create an interaction term to use on the between level.
 Linda K. Muthen posted on Friday, September 10, 2010 - 2:24 pm
Are you going to use observed variables on within and between or are you going to use a latent variable decomposition of the variable. See Example 9.1 for an explanation of these two approaches.
 Artur Pokropek posted on Friday, September 10, 2010 - 10:34 pm
I try to have latent decomposition of two variables x and z and interactions between those latent parts on between level.
 Linda K. Muthen posted on Saturday, September 11, 2010 - 9:33 am
Do not put x and z on the WITHIN list and use the following for the between part of the MODEL command:

$BETWEEN%
fx BY x; x@0;
fz BY z; z@0;
xz | fx XWITH fz;
y ON fx fz xz;
 Lisa M. Yarnell posted on Friday, March 11, 2011 - 1:29 pm
Hello,

I am trying to analyze a model with a cross-level interaction, with a one-between (BEAT), one-within (AGG) design.

I tried the following code:
WITHIN = beat ;
BETWEEN = agg;
CLUSTER = subj;
DEFINE: beat_agg = beat * agg;
ANALYSIS: TYPE = TWOLEVEL RANDOM;
ALGORITHM = INTEGRATION;
MODEL:
%WITHIN%
s | trusty ON beat ;
%BETWEEN%
trusty ON agg;
s on agg;

This gave an error mesage: THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO A NON-ZERO DERIVATIVE OF THE OBSERVED-DATA LOGLIKELIHOOD.

I think the solution would be to fix the slope, using s@0.

However, this gives the message:
SERIOUS PROBLEM IN THE OPTIMIZATION WHEN COMPUTING THE POSTERIOR DISTRIBUTION. CHANGE YOUR MODEL AND/OR STARTING VALUES.

Can you give any advice on how to get this model to run?
 Linda K. Muthen posted on Monday, March 14, 2011 - 4:25 pm
Please send the files and your license number to support@statmodel.com.
 Patchara Popaitoon posted on Tuesday, March 15, 2011 - 4:22 am
Hi,

I would like to know how to set up the data for multilevel analysis. I have a unit level construct (team environment) with its measure is referring to the team environment but these survey items are reported by indivduals within the team. So, it is the unit level construct. In my case, I have 200 teams with 4-5 team members each. I wonder if I should aggregate the data from individual level to the unit level and treat this construct as the variable in the 'between' group command. Please advise. Thanks.
 Linda K. Muthen posted on Tuesday, March 15, 2011 - 11:02 am
See the following paper which is available on the website:

Lüdtke, O., Marsh, H.W., Robitzsch, A., Trautwein, U., Asparouhov, T., & Muthén, B. (2008). The multilevel latent covariate model: A new, more reliable approach to group-level effects in contextual studies. Psychological Methods, 13, 203-229.
 Katy Roche posted on Thursday, May 26, 2011 - 9:25 am
I am trying to test interactions while accounting for clustering (these are NOT cross-level interactions)...the clustering is only being accounted for in order to obtain correct standard errors.

With clustered data and tests of interactions, it is correct to specify: TYPE=COMPLEX and ALBORITHM=INTEGRATION? I am wanting to compare my results from the models accounting for clustering to those that did not -- in those models I specified TYPE=RANDOM.
 Linda K. Muthen posted on Thursday, May 26, 2011 - 10:57 am
You need to specify TYPE= COMPLEX RANDOM. This can be used with ALGORITHM=INTEGRATION.
 Katy Roche posted on Thursday, May 26, 2011 - 11:05 am
Thank you -- that did it. One more related question. When I run this same model without the interactions I get the error message that others have posted before (see below) and am curious to know why this would NOT be a problem in the model testing interaction effects.

Do you suggest I need to run a Montecarlo for the main effects structural model or am OK to rely on results despite this message? Nothing in results looks very different from teh model that does not account for clustering.

THE MODEL ESTIMATION TERMINATED NORMALLY

THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES MAY NOT BE TRUSTWORTHY FOR SOME PARAMETERS DUE TO A NON-POSITIVE DEFINITE FIRST-ORDER DERIVATIVE PRODUCT MATRIX. THIS MAY BE DUE TO THE STARTINGVALUES BUT MAY ALSO BE AN INDICATION OF MODEL NONIDENTIFICATION. THE CONDITION NUMBER IS -0.234D-PROBLEM INVOLVING PARAMETER 33.

THIS IS MOST LIKELY DUE TO HAVING MORE PARAMETERS THAN THE NUMBER OF CLUSTERS MINUS THE NUMBER OF STRATA WITH MORE THAN ONE CLUSTER.
 Katy Roche posted on Friday, May 27, 2011 - 8:42 am
In thinking about the problem I am running into with this error message for the main effects model (not interaction effects model)accouning for clustering, I redid analyses and specificed

TYPE = COMPLEX RANDOM;

in the main effects model. In that case, I do not get the error message. Of course, I also do not get standardized estimates that I want. So, I guess I am still wondering if I am OK to report coefficients from the main effects model accounting for clustering (TYPE=COMPLEX) despite the error message.
 Bengt O. Muthen posted on Friday, May 27, 2011 - 4:48 pm
I think you are, but only a Monte Carlo study could show it clearly.
 kirsten way posted on Friday, October 21, 2011 - 10:46 pm
Hi,

I'm trying to plot my significant cross level interaction using preacher's calculator. I've requested TECH3 in the output to get the coefficient covariances, but wanted to ask - how do I ascertain what variables the parameter numbers in the printout refer to?

Thank-you!
 Linda K. Muthen posted on Saturday, October 22, 2011 - 6:29 am
They refer to the parameter numbers in TECH1.
 MT posted on Monday, February 27, 2012 - 6:18 am
Dear Linda,

I am trying to model the following paths:

At the within-level, I have one predictor (strucjr) and a dependent variable (bevl). This relationship is maybe moderated by a level-2 variable (Tafh).

At the between-level, I have one predictor (Tstrucjr) and a dependent variable (Tbevl). This relationship may be moderated by a second level-2 variable (Tauto).

I have the following syntax but am not sure how to model the between-level moderation. Could you please help me with this?

CLUSTER IS Team;
BETWEEN IS Tafh Taut Tbevl Tstrucjr;
WITHIN IS StrucJR;
Centering = Grandmean (Tafh Taut);
Centering = Groupmean (StrucJR);

USEVARIABLES ARE
StrucJR Bevl Tafh Taut Tstrucjr Tbevl;

ANALYSIS:
TYPE = TWOLEVEL RANDOM;
ESTIMATOR = ML;
ALGORITHM = INTEGRATION;

MODEL:
%WITHIN%
s | Bevl ON StrucJR;

%BETWEEN%
s Bevl ON Tafh; !cross-level interaction
Tbevl ON Tstrucjr;
! between-level interaction?

Thank you so much in advance!
 Linda K. Muthen posted on Tuesday, February 28, 2012 - 10:30 am
You can use the DEFINE command to create the between-level interaction terms.
 Jan Eichhorn posted on Monday, March 05, 2012 - 1:55 am
Hello,

I am estimating a multilevel path model and estimate a cross-level interaction effect. When doing that, I cannot specify the direct effect of the level-1 predictor on the dependent any more. In non-SEM Multilevel models that usually is still possible - I would be grateful if you could let me know how I might be able to specify the direct effect of the level-1 predictor despite also estimating the cross-level interaction.

The relevant part of the model (there are some paths and covariates at the individual level) reads

%Between%

I ON A_SocCap;
LifeSat ON A_SocCap;

%Within%

I | LifeSat on DV_U;

So essentially my question is whether I can estimate the direct effect of DV_U on LifeSat at level-1 still or whether that is not possible in a ML SEM.

Thank you very much for your help!!
 Linda K. Muthen posted on Monday, March 05, 2012 - 8:59 am
Do you mean the direct effect LifeSat on DV_U? You specify this on within as a random effect. The mean and variance of this random effect are found on between.
 Jan Eichhorn posted on Monday, March 05, 2012 - 9:30 am
Dear Linda,

thank you very much - I forget that I get the mean estimated and that it would be that of course.

Thanks for your quick help!
Best wishes
 Patchara Popaitoon posted on Thursday, March 08, 2012 - 11:29 am
Dear Linda,

I have specified a cross-level effect model investigating employee perceptions at the individual level and their impact on the group level performance. The model is:

%within%
B on A;
%between%
C on B;
D on C;

The results are fine but the journal reviewers would like to know if we can identify the impact of A on C and D.

Thanks.
Pat
 Linda K. Muthen posted on Thursday, March 08, 2012 - 1:47 pm
To estimate cross-level interactions between A with C and C, you need a random slope model. See Example 9.2 in the user's guide.
 Patchara Popaitoon posted on Wednesday, March 14, 2012 - 4:51 am
Dear Linda,

Thanks for the advise on using a random slope to explain the corss-level interactions.

I have questions about the model specification provided in Example 9.1.

I would like to know how the grandmean (x) contributes to the analysis. There are both x and xm which already represent x variable in the within and between levels.

The other question is I wonder if we can assume that the system refer to random intercept y to represent y in the between part of the model if we use latent variable y in the within level.

Thanks.
Pat
 Linda K. Muthen posted on Wednesday, March 14, 2012 - 2:50 pm
Centering x is not necessary. It sometimes helps in interpretation to have a variable with mean zero.

y is not on the WITHIN list so y is a random intercept on the between level.
 joon hyung park posted on Thursday, March 22, 2012 - 9:16 am
Dear Linda,

I am testing the moderating effects of coping (AVO) between stressor (AS) and outcome (PD).

I ran it with following codes.
USEVARIABLES ARE SV_ID AS_1 PD_1 AVO_1 AS_AVO;
WITHIN are AS_AVO;
CLUSTER = SV_ID;

ANALYSIS: TYPE = TWOLEVEL random;
ALGORITHM=INTEGRATION;

! AVOIDANCE coping
MODEL:
%WITHIN%
PD_1 on AS_1; ! pd=psychologcial distress
PD_1 on AVO_1;
PD_1 on AS_AVO;

%BETWEEN%
fx by AS_1; AS_1@0;
fz by AVO_1; AVO_1@0
xz | fx XWITH fz;
PD_1 on fx fz xz;

I received...

*** WARNING in MODEL command
In the MODEL command, the following variable is a y-variable on the BETWEEN
level and an x-variable on the WITHIN level. This variable will be treated
as a y-variable on both levels: AS_1
...
as a y-variable on both levels: AVO_1
2 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS

THE ESTIMATED BETWEEN COVARIANCE MATRIX COULD NOT BE INVERTED.
COMPUTATION COULD NOT BE COMPLETED IN ITERATION 106.
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.


Could you me any suggestions?
 Linda K. Muthen posted on Thursday, March 22, 2012 - 12:52 pm
Please send the output and your license number to support@statmodel.com.
 Paraskevas Petrou posted on Tuesday, May 15, 2012 - 8:14 am
Dear Linda,

I am working on a model with 3 cross-level interactions predicting 3 within-level outcomes, resulting in 6 tested random slopes. I am following example 9.2 of the guide. This example has two alternative options. In the first alternative you specify:
y s ON w xm (between level)
And in the second alternative you specify:
y s ON w x (between level)

In my example I am interested to see if the moderator (w) explains the relationship from x to y (specified at the within level). So I can't see why I would include x or xm in this two statements above. Can I skip that completely and simply say the following:
y s ON w (between level) ?

When I do this, though, I cannot interpret my results. At the within level I can only see residual variances and corelations. If I know the estimate from w to s, don't I also need to know the estimate from x to y at the within level in order to interpret the pattern of my interaction?
 Bengt O. Muthen posted on Tuesday, May 15, 2012 - 6:33 pm
You don't need to include x or xm, but often these "contextual" variables have a significant influence on between.

When you have a random slope s and regress it on w (cross-level interaction) you estimate this regression's intercept, slope, and residual variance. The slope gives the interaction effect. You can think of the intercept as the influence of x on y at w=0.
 Paraskevas Petrou posted on Wednesday, May 16, 2012 - 12:30 am
Thank you for your reply, Bengt.

So if I understand correct the intercept of the slope shows the main effect of x to y (irrespective of w). How can I interpret the pattern of my interaction, though? Do I need to make a plot or can I interpret it directly from my findings?

I assume that in order to have a significant interaction the path from w to s needs to be significant. In my example, the intercept of the slope is non-significant. If the path from w to s is positive significant, does it mean that x to y becomes positive for high levels of w?

Best,
Paris
 Bengt O. Muthen posted on Wednesday, May 16, 2012 - 10:40 am
If you center w, the intercept is the effect of x to y at the w mean. Your sample statistics tell you what the SD of w is, so that you can evaluate the effect of x on y at say -1 SD and +1 SD away from the w mean.

Yes, a significant interaction happens when the influence of w on s is significant. The sign and value of the influence of x on y for different values of w is obtained as in my first paragraph.

You may also want to study this topiic in multilevel books such as Raudenbush-Bryk.
 Sarah Lindstrom Johnson posted on Wednesday, May 23, 2012 - 1:23 pm
We are trying to examine cross level interactions (i.e., s1 s2 on M032MNRT;) in this multilevel model. We received a ‘fatal error’ that we had a memory shortage due to 5 dimensions of integration needed. We are using an 8 processor. Is there something incorrect with our input statement?

Model:

%WITHIN%

Conct by CO1R CO4R CO6R CO7R CO8R CO12R CO13R CO20R SE1R SE2R;
Schl by SE4R SE7R AE1R AE2R AE3R MR1R SV23R;
culture by FC1R FC3R FC4R FC8R;


S1 | Conct on culture;
S2 | Schl on culture;

Conct on Male White;
Schl on Male White;

CO12R WITH CO7R;
SE2R WITH SE1R;
SE7R WITH SE4R;
CO4R WITH CO1R;
AE3R WITH AE1R;
MR1R WITH CO4R;
CO13R WITH CO6R;
AE1R WITH SE7R;
CO20R WITH CO4R;


%BETWEEN%

Conctb by CO1R CO4R CO6R CO7R CO8R CO12R CO13R CO20R SE1R SE2R;
Schlb by SE4R SE7R AE1R AE2R AE3R MR1R SV23R;

CO1R-SE2R@0;
SE4R-SV23R@0;

Conctb on M032Tnrl M032MNRT M032SUSP;
Schlb on M032Tnrl M032MNRT M032SUSP;

s1 s2 on M032MNRT;
 Bengt O. Muthen posted on Wednesday, May 23, 2012 - 5:13 pm
I assume you have a 64-bit computer. With 5 dimensions you have 15^5 = a very high number of integration points. Taken together with a large sample, this causes memory problems. Try

integration = montecarlo(5000);
 Ewan Carr posted on Wednesday, June 27, 2012 - 10:11 am
I have several questions relating to cross-level interactions in Mplus.

I'm using Bayesian estimation. The model is:

%WITHIN%
s | y ON x;
%BETWEEN%
x ON w;
s ON w;
y on x w;

(this model also includes a mediating pathway, from x --> w --> y)

[1] How can I interpret the cross-level interaction effect (i.e. the regression of s on w, where s is the slope and w is the contextual effect)? Bengt's comment on May 16th makes sense, but when I ask for sample statistics I get:

> SWMATRIX is available only for TYPE=TWOLEVEL with estimators ULSMV, WLS, WLSM or WLSMV. Request for SWMATRIX will be ignored.

[2] Related to [1] is there any way of getting predicted values from Mplus?

[3] How can I test the significance of the interaction? (beyond just looking at the p-value or credible intervals). I'm guessing DIC isn't available with type=twolevel yet?

In other words: is there any way of comparing nested models, when "type=twolevel random" and "estimator=bayes"?

[4] I've run similar models in R/MLwiN -- testing the cross-level interaction effect the MLM way (i.e. with an interaction term). I get substantially different results, which is slightly worrying. Obviously, these are completely different approaches, but is there any reason to expect such variation?

Many thanks,

Ewan
--
 Bengt O. Muthen posted on Wednesday, June 27, 2012 - 8:54 pm
1. Do a Type = twolevel basic run to the sample statistics. Bayes does not use sampstat in its analysis and that's why you don't get that in your run.

2. Not directly.

3. The CI for s on w would seem to be the best way.

4. If the same estimator (ML/Bayes) is used, you should get the same results. If not, send the 2 outputs to Support.
 Ewan Carr posted on Thursday, June 28, 2012 - 3:00 am
Thank you Bengt, once again, for such a speedy response. It's much appreciated.
 Ewan Carr posted on Thursday, June 28, 2012 - 6:10 am
A quick follow-up question:

I've re-run the model using "type=twolevel basic", and the following estimation options:

type = twolevel basic;
estimator = WLS;
algorithm = integration;
integration = 7;

(Bayesian estimation isn't possible).

[Question 1]:

I've removed the "MODEL:" statement — that is, I'm just estimating an empty model. This is because "type=random" isn't possible with WLS.

Is this correct?

[Question 2]:

I get a file "swmatrix.dat" out. How is this file organised?

It just appears as a single column of numbers, with no labels (see here. I've searched the user guide and website for help with this, but can't find anything.

I need the SD of the between-level variable (w).

Many thanks,

Ewan
--
 Bengt O. Muthen posted on Thursday, June 28, 2012 - 8:41 am
Q1. Yes.

Q2. SW saving is described on page 668. It is not meant for inspection but rather to be available in a second run so these quantities don't have to be computed again. If you are interested in the within and between sample statistics, you look at the output from a Type=Twolevel Basic run, where you put w on the Between list.
 Ewan Carr posted on Friday, June 29, 2012 - 4:39 am
Thanks Bengt.

I think I've got this sorted. In case this is of use to others, I'll put my working here.

The model is:

%WITHIN%
s | satlife ON empsec;
%BETWEEN%
s ON rrlongsing;
satlife ON rrlongsing;


The sample statistics for the contextual variable (rrlongsing) are:

Variance387.39
SD19.68


The coefficient for the regression of "S ON RRLONGSING" is 0.007, and the intercept for S is -0.195.

I then calculate values for the regression at 1 SD above and below the mean of RRLONGSING:

19.68 * 0.007 = 0.138


This gives me the following values:

rrlongsing S ON empsec
Mean - 1 SD -19.44 -0.333
Mean 0.24 -0.195
Mean + 1 SD 19.92 -0.057


These can be plotted (see here), which seems to make sense.

Thanks!
 Bengt O. Muthen posted on Friday, June 29, 2012 - 8:25 am
If you express your computations in Model Constraint using model parameter labels you will both get better precision (more decimals) and SEs for the points in your graph.
 Kathryn Modecki posted on Thursday, July 19, 2012 - 1:18 am
I have come across a reference that suggests that random slopes are not necessarily required to test for (and subsequently find) a significant cross-level interaction. However, Hox makes no mention of this-nor have I seen any reference to this in searching the mplus forum. In a 2-level model, I have systematically tested for variation in level 1 slopes, and nothing is significant. However, when I 'cheated' and tested for cross-level interactions, several are significant. Is it reasonable to do this based on theory? Thanks.
 Bengt O. Muthen posted on Thursday, July 19, 2012 - 6:12 am
What's the reference?
 Kathryn Modecki posted on Thursday, July 19, 2012 - 9:04 pm
Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling. T. A. B. Snijders, Roel J. Bosker. (1999) p 96. This comes up in a google search: "multilevel cross level interaction non significant random slopes."
Also-Lesa Hoffman's talk: Society of Multivariate Experimental Psychology Annual Meeting October 2011
Systematically Varying Effects in Multilevel Models: Permissible or Problematic?
available at: http://psych.unl.edu/hoffman/Sheets/Talks.htm

Thanks.
 Bengt O. Muthen posted on Friday, July 20, 2012 - 8:44 pm
I see. Yes, this is a phenomenon that also happens in growth modeling where a slope growth factor may not have significant variance when excluding time-invariant predictors, but including them the effect of them on the slope is significant so the slope does vary. As the book page you mention says, it is a matter of having more power when you include the level 2 covariate and its interaction with the level 1 covariate.

So, yes, it is reasonable to do this.
 Kathryn Modecki posted on Sunday, July 22, 2012 - 6:01 am
Thank you Bengt. I also noticed that in Mplus Short Course Lesson 5A (slide 29) the random slopes are correlated with the dv, in what looks like a cross-level interaction (pasted below). Is this correct? I have seen elsewhere just the cross-level interaction, without "M92 with s1 s2". Thanks.

%WITHIN%
s1 | m92 ON female;
s2 | m92 ON stud_ses;
%BETWEEN%
m92 s1 s2 ON per_adva private catholic mean_ses;
m92 WITH s1 s2;
 Bengt O. Muthen posted on Sunday, July 22, 2012 - 9:50 am
Yes, this is a cross-level interaction model because s1, s2 are regressed on between-level covariates. The between level has 3 dependent variables and whenever there are several DVs I would covary their residuals. So, I would even add s1 with s2. But that covariation is a separate issue from cross-level interaction.
 Kathryn Modecki posted on Monday, July 23, 2012 - 12:32 am
That makes sense, thanks. Finally, when I run my MLM models (MLF estimator) with cross level interactions, they have significant p-values. However, testing nesting models using -2LL none of interaction models are significantly better. My understanding is that the -2LL is the better test, but this seems unusual. Can you indeed test nested models with MLF? Also, I'm assuming this is a 2-tailed test? Thanks very much.
 Linda K. Muthen posted on Monday, July 23, 2012 - 9:44 am
Please send the two outputs and your license number to support@statmodel.com.
 Kathryn Modecki posted on Tuesday, July 24, 2012 - 2:53 am
Thanks, I realized I needed to zero out the cross-level effects in the null model. I was incorrectly comparing a general two-level model to a two-level random model.
 Ewan Carr posted on Sunday, July 29, 2012 - 2:53 am
Dear Bengt/Linda,

I'm trying to interpret a coefficient in a two-level path analysis model.

The model is:

%WITHIN%

s | satlife ON empsec;

%BETWEEN%

satlife ON uempav grow;

empsec ON cons;
empsec ON uempav grow;
satlife ON empsec;


The between-level output is below; the coefficient of interest is highlighted:


SATLIFE ON

UEMPAV 0.000
GROW 0.037
EMPSEC -0.810

EMPSEC ON

CONS -0.927
UEMPAV 0.000
GROW -0.038

Means
S -0.230


My question, then, is what exactly does this coefficient represent? The mean S shows the individual-level effect of EMPSEC on SATLIFE, but I'm not sure how the between-level effect should be interpreted?

Many thanks,

Ewan
--
 Linda K. Muthen posted on Sunday, July 29, 2012 - 9:48 am
Please send the output and your license number to support@statmodel.com. Empsec should not be used on between. It should be on the WITHIN list. I need to see the full situation.
 Ewan Carr posted on Sunday, July 29, 2012 - 11:55 am
Thanks, I will do.

I was following the example of:

Preacher, K. J., Zhang, Z., & Zyphur, M. J. (2011). Alternative methods for assessing mediation in multilevel data: The advantages of multilevel SEM. Structural Equation Modeling, 18, 161- 182.


The syntax was adapted from:

http://www.quantpsy.org/pubs/syntax_appendix_081311.pdf
 Tom Carwell posted on Wednesday, February 06, 2013 - 11:19 am
Hi, first of all the forum is a great learning platform, thank you for managing it.
After reading the relevant posts, I wanted to ask your input on Mplus codes I set up for testing two cross-level interactions.

Model A- in which a dichotomous level-2 variable (high-1, low-0) moderates the relationship between two level-1 continuous variables:

USEVARIABLES ARE x y w;
WITHIN = x y;
BETWEEN = w;
Cluster = id;
ANALYSIS: TYPE IS COMPLEX TWOLEVEL random;
MODEL:
%WITHIN%;
beta1 | y ON x;
%BETWEEN%;
beta1 ON w;


Model B- in which a continuous level-2 variable moderates the relationship between a level-2 continuous variable and level-1 continuous variable

USEVARIABLES ARE x y w inter;
WITHIN = y;
BETWEEN = x w;
Cluster = id;
DEFINE: inter=x*w
ANALYSIS: TYPE IS TWOLEVEL random;
MODEL:
%WITHIN%;
%BETWEEN%;
y ON x w inter;
 Linda K. Muthen posted on Thursday, February 07, 2013 - 9:52 am
These look correction. In Model B, be certain the variance of y is estimated as the default. Otherwise add it on within.

y;
 Tom Carwell posted on Saturday, February 09, 2013 - 1:06 am
Hi Linda, thanks for time and suggestion.
 Kätlin Peets posted on Thursday, February 14, 2013 - 10:25 am
Hi,

I am conducting a simple slope analysis (following up a cross-level interaction). I am interested in associations between my individual-level predictor and dependent at high and low values of the classroom-level covariate (when pbur_1 is one standard deviation below and above the mean; or at -.032 and at .032). Is this syntax (Model constraint part) correct?

%within%
s1|pder_1 on affemp;

%between%

s1 ON pbur_1(gam1);
[s1] (gam0);
s1 with pder_1;

MODEL CONSTRAINT:
New (ylow yhigh);
ylow = (gam0+gam1*(-.032));
yhigh = (gam0+gam1*.032);
 Linda K. Muthen posted on Thursday, February 14, 2013 - 1:43 pm
I think this is correct as long as pbur_1 is centered with mean zero.
 Hannah Miller posted on Thursday, March 07, 2013 - 6:33 pm
Hello,

I am trying to estimate a multilevel CACE model. We have students nested within schools. The schools were randomly assigned to receive an intervention and some students complied (i.e., attended) the intervention. My CACE model was working fine, but now I am trying to add a cross-level interaction between the intervention (at level two) and a student characteristic (i.e., Spanish at level one). When I do that using the syntax below, I get the message "Fatal error: Internal code GH1002." Do you have any suggestions?

Cluster = sid;
Classes = c(2);
Training = c1-c2;
Within = Spanish FRL Latino Other logabs pretest p6 recip shexp1 shexp2 shexp3;
Between = FAST D1 D2 D3 B1 S1 S2 Cohort1;
Analysis: Type = twolevel random mixture;
miterations = 200;
Model: %within%
%overall%
pscale on Spanish FRL Latino Other logabs pretest;
c#1 on Spanish FRL Latino Other logabs pretest p6 recip shexp1 shexp2 shexp3;
s | pscale on Spanish;
%between%
%overall%
pscale on FAST D1 D2 D3 B1 S1 S2 Cohort1;
s on FAST;
%c#1%
pscale on FAST;
%c#2%
pscale on FAST@0;
 Linda K. Muthen posted on Friday, March 08, 2013 - 7:15 am
Please send your output and license number to support@statmodel.com.
 Lonneke Dubbelt posted on Monday, March 11, 2013 - 12:31 am
Dear Muthen,

We are trying to estimate a model with a level 2 outcome variable (pub) and two cross-level interactions (gender x motiv & goalcom x restime) We have used the syntax below.

DEFINE: CENTER gender goalcom pub (GRANDMEAN);
ANALYSIS:
TYPE = TWOLEVEL RANDOM;
ESTIMATOR = ML;
ALGORITHM = INTEGRATION;

MODEL:
%WITHIN%
s1 | restime ON motiv;
%BETWEEN%
s1 ON gender;
s2 | pub ON restime;
s2 ON goalcom;

This resulted in the following warning:
*** WARNING in MODEL command
In the MODEL command, the following variable is an x-variable on the BETWEEN
level and a y-variable on the WITHIN level. This variable will be treated
as a y-variable on both levels: RESTIME
*** ERROR in MODEL command
Observed variable on the right-hand side of a between-level ON statement
for a random slope must be a BETWEEN variable.
Problem with: RESTIME

Is there a way to model this model?

Thank you
 Linda K. Muthen posted on Monday, March 11, 2013 - 10:55 am
The two random regressions should be on the within level not the between level. Why do you have

s2 | pub ON restime;

on between?
 Lonneke Dubbelt posted on Tuesday, March 12, 2013 - 1:30 am
Dear Linda,

Thank you for your response.
pub is a between level outcome, that's why we defined it on the between level. Gender and goalcom are also on the between level.
 Linda K. Muthen posted on Tuesday, March 12, 2013 - 9:10 am
T think what you want is:

WITHIN = RESTIME;
BETWEEN = gender clusrest goalcom inter;
MODEL:
%WITHIN%
s1 | restime ON motiv;
%BETWEEN%
s1 ON gender;
pub ON clusrest goalcom inter;

where clusrest is a cluster level observed variable that you create in DEFINE along with the interaction between that variable and goalcom (inter).
 Lonneke Dubbelt posted on Thursday, March 14, 2013 - 3:16 am
Thank you for your response.
I've made the adjustments, but I still get an error. My input looks like this:

WITHIN = motiv restime;
BETWEEN = gender clusrest goalcom pub inter;
CLUSTER = employee;
MISSING ARE ALL (999);

DEFINE: CENTER gender goalcom pub (GRANDMEAN);
ANALYSIS:
TYPE = TWOLEVEL RANDOM;
ESTIMATOR = ML;
ALGORITHM = INTEGRATION;

MODEL:
%WITHIN%
s1 | restime ON motiv;
%BETWEEN%
s1 ON gender;
pub ON clusrest inter;

And this is the error I get:

*** WARNING in MODEL command
Variable on the left-hand side of an ON statement in a | statement is a
WITHIN variable. The intercept for this variable is not random.
Variable: RESTIME
*** ERROR
One or more between-level variables have variation within a cluster for
one or more clusters. Check your data and format statement.

Between Cluster ID with variation in this variable
Variable (only one cluster ID will be listed)

INTER 1
 Linda K. Muthen posted on Thursday, March 14, 2013 - 6:29 am
I think it should be

WITHIN = motiv;

not restme

The inter variable should be the same for each cluster member. All variables on the between list need to be the same for each cluster member. Check you data.
 Lonneke Dubbelt posted on Monday, March 18, 2013 - 2:33 am
Thank you for your response.
I've checked my data and tried different things. Now I get this error:
One or more variables in the data set have no non-missing values.
Check your data and format statement.

Continuous Number of
Variable Observations Variance

PUB 200 19.296
DAY 200 2.010
RESTIME 200 6.476
MOTIV 200 1.241
GENDER 200 0.241
GOALCOM 200 0.498
CLUSREST 200 3.764
**INTER 0

This is what my define statement looks like:
DEFINE:
clusrest = CLUSTER_MEAN (restime);
CENTER gender clusrest goalcom pub inter (GRANDMEAN);
inter = goalcom * clusrest;

Thank you in advance.
 Linda K. Muthen posted on Monday, March 18, 2013 - 6:27 am
Please send your input, data, output, and license number to support@statmodel.com.
 Hannah Miller posted on Thursday, April 18, 2013 - 7:53 am
Hello,

I would like to estimate a two-level CACE model with a cross-level interaction between the treatment and a covariate. Since the treatment effect is fixed at zero for non-compliers, I think the cross-level interaction should also be fixed at zero for non-compliers. I thought the code would be something like this:

Model: %within%
%overall%
pscale on EngLat Other FRL;
c#1 on EngLat SpanLat Other FRL pretest p6 recip shexp1 shexp2 shexp3;
s | pscale on SpanLat;
%between%
%overall%
pscale on FAST D1 D2 D3 B1 S1 S2 Cohort1;
s on FAST;
%c#1%
pscale on FAST;
s on FAST;
%c#2%
pscale on FAST@0;
s on FAST@0;

However, I am getting this error command: "*** ERROR in MODEL command
Parameters involving between-level variables are not allowed to
vary across classes."

The model runs fine when I do not include the "s on FAST" commands separately for each compliance class, but then the results show a significant interaction between the treatment and the covariate for non-compliers.

Thanks in advance.
 Linda K. Muthen posted on Thursday, April 18, 2013 - 11:12 am
Please send the full output and your license number to support@statmodel.com.
 Dave posted on Thursday, May 16, 2013 - 9:45 am
I have encountered a situation similar to the one described by Kathryn Modecki posted on Monday, July 23, 2012 - 12:32 am. I am comparing the following models:

%WITHIN%
s1 | DV on IV;
%BETWEEN%
DV ON Con1 Con2;
S1 ON Mod1 Mod2 Int@0 Con1 Con2;
DV with s1;

MODEL FIT INFORMATION
Free Parameters: 12
Loglikelihood
H0 Value - -0.154
H0 Scaling Correction Factor - 1.5249

And

%WITHIN%
s1 | DV on IV;
%BETWEEN%
DV ON Con1 Con2;
S1 ON Mod1 Mod2 Int Con1 Con2;
DV with s1;

MODEL FIT INFORMATION
Free Parameters: 13
Loglikelihood
H0 Value - 1.446
H0 Scaling Correction Factor - 1.4745

Int is an interaction term created by multiplying Mod1 and Mod2 to create a three way cross level interaction. I believe these models are nested. Int has a significant p value (p = 0.033). When testing these two nested models using -2LL the model with the interaction is not significantly better (chi_sq = 3.66 vs 3.84; p = 0.055). I am wondering if you can provide me with guidance regarding how to interpret this finding. Thanks in advance for your attention.
 Bengt O. Muthen posted on Thursday, May 16, 2013 - 11:27 am
It sounds like you are comparing an approximate z-test (which when squared is approx. chi2 with 1 df) p-value of 0.033 with an approximate chi-2 test with 1 df with a p-value of 0.055. Such a small p-value difference can be expected, particularly in samples that are not large, in this case the number of clusters. You have two methods giving asymptotic approximations to chi-2 and for any given sample size they can differ.
 Praneet Randhawa posted on Sunday, June 30, 2013 - 6:48 am
Hi Linda:

I ran a multilevel model to test some cross-level interactions. Now, I am interested in plotting those effects using Preacher's website. I was not very sure if I was inputting the right numbers in the table. I would greatly appreciate if you could confirm where I should look for the numbers

Regression Coefficients (gamma for Intercept, gamma for IV, Gamma for Moderator and gamma for Interaction effect)?
Coefficient Variances?
Coefficient Covariances?
Conditional Values for w and x (if I want to model +1SD, mean,-1SD values of the moderator)?
df (int)?
df (slope)?

Here is the link to Preacher’s website and I am referring to case 3: http://www.quantpsy.org/interact/hlm2.htm

Your help in this matter would be greatly appreciated!

Thanks!
 Linda K. Muthen posted on Monday, July 01, 2013 - 7:41 am
The values you need are found in TECH3. Contact Kris Preacher is you have question about his link.

You can also see Example 3.18 in the user's guide which uses the LOOP option. This can be applied to cross-level interactions.
 Praneet Randhawa posted on Wednesday, July 10, 2013 - 8:10 am
Hi Linda:

Thanks a ton for your response. I am sorry for the tardy reply. I was under the impression that I will get an email notification once you respond to my query, which obviously I did not get. Anyway, I greatly appreciate the help.

Thanks again,
Praneet
 Linda K. Muthen posted on Wednesday, July 10, 2013 - 12:26 pm
Responses are given on Mplus Discussion not via email.
 Sara Guediri posted on Monday, September 09, 2013 - 10:35 am
Hi,

I'm testing a cross-level interaction and depending on whether I grand mean centre the Level 2 moderator or not, I get different results for the intercept of the random slope.
This affects the direction of the cross-level interaction. Should I go with the results when the level 2 moderator is grand-mean centred or leave the level 2 variable at its raw score?

Many thanks
 Linda K. Muthen posted on Tuesday, September 10, 2013 - 11:01 am
You should grand mean center. See the Raudenbush and Bryk book for further information.
 Johnna Capitano posted on Friday, October 11, 2013 - 11:22 am
As a follow up to the previously posted question and answer:

" kirsten way posted on Friday, October 21, 2011 - 10:46 pm
Hi,

I'm trying to plot my significant cross level interaction using preacher's calculator. I've requested TECH3 in the output to get the coefficient covariances, but wanted to ask - how do I ascertain what variables the parameter numbers in the printout refer to?

Thank-you!

Linda K. Muthen posted on Saturday, October 22, 2011 - 6:29 am
They refer to the parameter numbers in TECH1."

Since I have 10 parameters and TECH3 reports 11 in the covariance matrix, should I be looking at the number labels assigned under Beta in TECH1? I thought it odd that the numbering goes 0,2,3,4... and just want to be sure I am looking at the correct number labels. THANK YOU!

Johnna
 Bengt O. Muthen posted on Friday, October 11, 2013 - 11:39 am
Please send your output to Support so we can see what you are referring to.

Note also that you no longer need to use the Preacher calculator to plot cross-level interactions because Mplus offers the LOOP and PLOT options of MODEL CONSTRAINT. See slides 21-24 of the Utrecht training August 2012:

http://mplus.fss.uu.nl/files/2012/09
V7Part1.pdf
 Johnna Capitano posted on Monday, October 14, 2013 - 8:10 am
Bengt - Thank you. I just sent my output. I could not find the slides or presentation you suggested. It says file not found. Would you mind checking the link and resending? I'd appreciate it.

Regards,
Johnna
 Bengt O. Muthen posted on Monday, October 14, 2013 - 8:56 am
Perhaps you didn't get both lines of the link?

http://mplus.fss.uu.nl/files/2012/09
V7Part1.pdf
 Paraskevas Petrou posted on Friday, November 29, 2013 - 5:04 am
Dear Bengt & Linda,

Below is a cross-level interaction I am testing in a multi-level latent SEM model:

Within = x1 x2 x3;
Between = m1 m2 m3 w1 w2 w3;

ANALYSIS:
Type is random twolevel;
ESTIMATOR = ML;
ALGORITHM=INTEGRATION;
MODEL:
%WITHIN%
F1 by y1 y2 y3;
F2 by x1 x2 x3;
s | F1 ON F2;
%BETWEEN%
F3 by m1 m2 m3;
F4 by w1 w2 w3;
s ON F3;
F1 ON F4;

The above model works but only without the very last statement "F1 ON F4" because F1 has been defined as within-level. I need this statement to control for the effect of a between-level variable to a within-level variable. In path analysis I am able to work around this problem but not in a latent model. What could I do?

Thanks!
Paris
 Linda K. Muthen posted on Friday, November 29, 2013 - 9:42 am
You must create a factor on between that uses the between part of y1, y2, and y3.

MODEL:
%WITHIN%
wF1 by y1 y2 y3;
F2 by x1 x2 x3;
s | F1 ON F2;
%BETWEEN%
bF1 by y1 y2 y3;
F3 by m1 m2 m3;
F4 by w1 w2 w3;
s ON F3;
bF1 ON F4;
 Paraskevas Petrou posted on Tuesday, December 03, 2013 - 11:56 pm
Dear Linda,

Thank you!

I am wondering if the statement "s | F1 ON F2" is a full test of moderation. Normally in moderation you also need the main effect of the moderator on the outcome, e.g., "bF1 ON F3". Should I include this statement or is it accounted for by the statement "s | F1 ON F2"?

Also, how do I plot this interaction?
 Linda K. Muthen posted on Wednesday, December 04, 2013 - 9:10 am
s | F1 ON F2 defines a random slope. I'm not sure how you see this as moderation.
 Ewan Carr posted on Monday, March 03, 2014 - 1:44 pm
Dear Bengt/Linda,

I'm following up on a question from two years ago.

I have a multilevel path model, with a cross-level interaction (implemented as a random slope). Mplus doesn't currently offer overall model fit statistics for multilevel SEM models (e.g. DIC). To test the significance of the cross-level interaction, I asked:


quote:

How can I test the significance of the interaction? (beyond just looking at the p-value or credible intervals)




The response I got was:


quote:

3. The CI for s on w would seem to be the best way.

(Bengt, 2012-06-27 2054)




Is there any reference/citation you could suggest that would either support this decision, or where a similar approach is taken? (A reviewer is asking for a measure of overall model fit; I'm trying to argue that this approach -- of looking at the credible intervals -- is adequate).

Many thanks,

Ewan
--
 Linda K. Muthen posted on Tuesday, March 04, 2014 - 10:12 am
In this situation, no absolute fit statistics are available. There is not a single covariance matrix because the variance of y varies as a function of x. This is not something specific to Mplus.

The confidence interval gives the same result as a one degree of freedom chi-square difference test between a model without the interaction term and a model with the interaction term.
 Ewan Carr posted on Saturday, March 08, 2014 - 10:46 am
Many thanks, that is most useful.

Ewan
 Briana Chang posted on Wednesday, April 16, 2014 - 3:12 pm
Dear Bengt & Linda,

I am attempting to write syntax for a multilevel structural equation model with several cross-level interactions.

The relationship of interest is between 7 indicators for race/gender (e.g., White Female, Black Male, Black Female, etc) and a continuous latent variable. This relationship is defined by partially mediated moderation by group-level variables where B1 moderates these relationships and B2 partially mediates this moderation.

Given that I would need 7 random slopes to specify the cross-level interactions as typically defined in Mplus (and that from my understanding, modeling several random slopes can get quite hairy), I would like to estimate this model with a random intercept only (and no random slopes).

Can I create cross products between my 7 indicators and B1 for use in such a model instead of utilizing random slopes?

Thank you for any help!
Briana
 Bengt O. Muthen posted on Wednesday, April 16, 2014 - 5:47 pm
Yes.
 C G posted on Tuesday, September 16, 2014 - 1:20 pm
Dear Dr. Muthen

I am using Mplus to do multi-level path analyses. I want to test the interaction results from a cross level prediction of a level 1 random effect by a level 2 covariate.

When I interpret and plot the results, I am not sure which mean score to use as there are two sorts of mean scores, one at the within level and another at the between level.

Any help will be highly appreciated. Thank you very much.
 Bengt O. Muthen posted on Tuesday, September 16, 2014 - 1:46 pm
Have a look at the cross-level interaction plot information at

http://www.statmodel.com/Mediation.shtml
 Ansylla Payne posted on Saturday, October 04, 2014 - 12:18 am
Hi, what does "ERROR in VARIABLE command
Unknown modifier in the BETWEEN option: LEVEL2" mean?
 Linda K. Muthen posted on Saturday, October 04, 2014 - 5:21 am
It sounds like you are using level2 instead of the name of your level 2 cluster variable. If not, please send the output and your license number to support@statmodel.com.
 Ansylla Payne posted on Saturday, October 04, 2014 - 10:14 am
Dear Linda:

Thank you kindly for your response. I have forwarded my files to the address given.

Regards,
Ansylla
 Julie McCarthy posted on Wednesday, October 22, 2014 - 11:17 am
Good afternoon,

I am running a two-level path analysis in MPlus and would like to model a cross-level interaction where the IV is at the group level, the dv is at the individual level and the moderator is at the group level. I have identified the IV and moderator as between subject effects.

It is also my understanding that I can use the define command to create the interaction variable:

Define:
int = IV*moderator;

Where I am having difficulty is creating the syntax for the within and between effects. In other words, do I include syntax on the within and between effects? Where would the following command appear?

int on IV;

Any help you could provide is greatly appreciated.
 Linda K. Muthen posted on Thursday, October 23, 2014 - 6:44 am
See Example 9.2. You must have a random slope to have a cross-level interaction. See also Slide 45 of the Topic 7 course handout on the website. This shows the formulas.
 Julie McCarthy posted on Thursday, October 23, 2014 - 9:00 am
Thanks Linda. I have modeled it that way am getting the following error message:

"Between-level variables cannot be used in random slope definitions on the
within level. "

My IV and moderator are at the between level, and my DV is at the within level. As such, I believe I have to use my between-level DV on the within level syntax. The syntax I am using is as follows:

MODEL:
%WITHIN%
RSLOPE | Y ON X;

%BETWEEN%
Y RSLOPE ON X;
Y WITH RSLOPE;

Thanks so much.
 Linda K. Muthen posted on Thursday, October 23, 2014 - 10:39 am
You cannot use between variables in the within part of the model. Read Examples 9.1 and 9.2 and see Slide 45 of Topic 7.
 Briana Chang posted on Thursday, October 23, 2014 - 11:10 am
Hello Linda and Bengt,

I wrote several months back about using cross-level interaction terms instead of using random slopes (4/16/2014, http://www.statmodel.com/cgi-bin/discus/show.cgi?12/788) and have a follow up question.

I am interested in running a multilevel path model with mediated moderation. I am attempting to run an intercepts-as-outcomes model so I am using interaction terms to avoid random slopes.

The basic idea is this:

X affects Y (both variables are Level 1 variables, X is dichotomous, Y is continuous)

A (a Level 2 continuous variable) moderates the effect of X on Y, and this moderation is partially mediated through B (a Level 2 continuous variable).

My interaction term is AX so that the interaction is a cross-level interaction.

From my understanding, I must run the following in the MODEL command:

%WITHIN%
Y on X
Y on AX
X with AX

%BETWEEN%
Y on A
Y on B
B on A AX X
A with AX
X with A

Is this correct? My concern is specifying relationships on the between level that involve Level 1 covariates.
 Bengt O. Muthen posted on Thursday, October 23, 2014 - 12:24 pm
I would think you want to say

%WITHIN%
Y on X
Y on AX

%BETWEEN%
Y on A
Y on B
B on A

Your within statement X with AX is not needed because X and AX are covariates.

Are your between statements B on AX X because you want to use the AX and X latent between parts on between?
 Briana Chang posted on Friday, October 24, 2014 - 5:41 am
In your correction, I understand where the moderation comes in with the inclusion of:

%WITHIN%
Y on X
Y on AX

%BETWEEN%
Y on A

But I am missing where this moderation effect is mediated by B. This was why I had included the statement "B on AX".

And since I suppose is possible that the X->Y effect is also mediated by B, I included "B on X".

Does that make sense? I can see from elsewhere on the discussion board that "level-2 random intercept part of an individual's variable predicts the level-2 variable" but I'm not sure what this would mean for the syntax.

Thanks for any help!
 Bengt O. Muthen posted on Friday, October 24, 2014 - 12:01 pm
You can't have "B on AX" on between because the interaction variable AX varies across subjects so it is not a Between-level variable.

It seems you need to use a random slope approach instead, like

Within
s | y on x;

Between

s on b;

b on a;

plus

y on a b;

Then the A moderation of the effect of x on y is mediated by B.
 Ansylla Payne posted on Sunday, February 01, 2015 - 6:33 pm
Hi

Can you tell me what this error message mean and how do I treat with it?


*** ERROR
One or more between-level variables have variation within a cluster for
one or more clusters. Check your data and format statement.

Between Cluster ID with variation in this variable
Variable (only one cluster ID will be listed)

EI3 41
 Linda K. Muthen posted on Monday, February 02, 2015 - 5:38 am
Variables on the BETWEEN list must contain the same value for each cluster member. This message indicate that this has been violated. This happens for variables EI3 in cluster 41.
 Ansylla Payne posted on Monday, February 02, 2015 - 2:50 pm
But I don't quite understand this? Way back at the data entry stage if there were members of the group who no longer participated in the study at T3 then no values were entered (not even corresponding between level data)... .so for example if the group went from 5 to 2 then EI values were only entered for the 2 remaining individual level participants ...... should i have entered the corresponding between level data for the three who no longer participated?
 Linda K. Muthen posted on Monday, February 02, 2015 - 3:17 pm
If a person is in the data set, they should be assigned the same value for variables measured at the cluster level as all other cluster members.
 claudia sacramento posted on Thursday, April 09, 2015 - 9:22 am
Dear All,

Often I have to test cross-level interactions in complex models in which it has been suggested to create latent variables to form the interaction term (XL by XL@1;XL@0).

I was therefore expecting the following approaches to test a cross-level interaction to held similar results, but this is not the case. Am I wrong to assume this should be similar? When is it appropriate then to create a latent variable on subsequently create an interaction term.
Many thanks for any clarification!


MODEL 1
Cluster = team;
between = L2M ;
within = ;
Analysis:
Type = twolevel random; Estimator = ml;

Model:
%Within%
S|L1Y ON L1X

%Between%
L1Y ON L1X L2M;
S ON L2M;


MODEL 2
Cluster = team;
between = L2M ;
within = ;
Analysis:
Type = two level random; Estimator = ml; algorithm = integration;

Model:
%Within%
L1Y ON L1X;

%Between%
L1X_b by L1X@1; L1X@0;
INT | L1X_b xwith L2M;

L1Y ON L1X_b L2M;
L1Y ON INT;
 Bengt O. Muthen posted on Thursday, April 09, 2015 - 11:47 am
In Model 1 the random slope causes an interaction between L2M and the within-level part of L1X. In Model 2 you have instead an interaction between L2M and the between-level part of L1X.
 claudia sacramento posted on Thursday, April 09, 2015 - 2:05 pm
Thank you very much, this is now clear.

So I assume that the correct option will depend on the theoretical assumptions.

Should I want to test the interaction regarding both the within and the between parts should I then integrate both approaches?

Thank you,
Claudia
 Bengt O. Muthen posted on Thursday, April 09, 2015 - 2:08 pm
Right on both.
 Kristin Hildenbrand posted on Sunday, June 14, 2015 - 3:23 am
Hi,
I am running a cross-level interaction model (IV: FSSB and DV: WFBI at the 1st level, W:agCFam at the 2nd level) with control variables (ageI1 sexI1 full).
Why do I get different findings for s on agCFam when I run the two models below and which one is the correct approach?Model 1 and 2 should only differ in regards to the plotting? Also, if I define the interaction via define and regress s on it in the between, I get p = .445.
If I center according to a hybrid approach (Aguinis & Culpepper, 2015; Preache et al.,2010), I get totally different significant findings for all of the first two models, and p =.951 for the define command model. Also, is it okay to only have the controls at the within? Because if I add them to the between they would function as moderators.
Thanks, Kristin

1. Handbook 9.2 Part 1 (s on agCFam = p = .127)
within = FSSB sexI1 ageI1 full;
between = agCFam agFSSB;
Define: Center FSSB (grandmean);
ANALYSIS: type = twolevel random;
Model: %within%
s| WFBI on FSSB sexI1 ageI1;
%between%
WFBI s on agCFam agFSSB;
WFBI WITH s;

2. Handbook 9.2 Part 2 (s on agCFam = p = .100)
Model: %within%
s| WFBI on FSSB sexI1 ageI1 full;
%between%
WFBI on agCFam agFSSB;
[s] (gam0);
s on agCFam (gam1);
agFSSB;
WFBI WITH s;
 Kristin Hildenbrand posted on Sunday, June 14, 2015 - 3:26 am
The first part of my models, if centered according to the hybrid approach, looks like this:
usevar = teamM WFBI FSSB agFSSB agCFam sexI1 ageI1 full;
cluster = teamM;
within = FSSB sexI1 ageI1 full;
between = agCFam agFSSB;
Define: Center agCFam agFSSB (grandmean);
Center FSSB sexI1 ageI1 full (groupmean);
p = .000, p = .001 and p =.951 respectively for s on agCFam for the first, second and define model.
Sorry for my limited knowledge, I am not a mathematician.
 Bengt O. Muthen posted on Monday, June 15, 2015 - 2:27 pm
In your first step you say

s on agCFam agFSSB;

while in your second setup you say

s on agCFam (gam1);
agFSSB;

In other words, you have only 1 predictor in the second setup, not 2.

We ask that no more than one window is used for postings.
 Amelie G posted on Wednesday, August 12, 2015 - 2:36 pm
Hi Linda & Ben:
I have analyzed a two-level model with a predictor x, a meditator m and 2 outcomes y & z in a team sample. I argued that the relationships occur at both the individual and the team level. As all variables were assessed by asking individuals (L1), I acknowledge Preacher, Zhang & Zhypur, 2010, stating that variables assessed at L1 typically have both L2 and L1 components. They further state that for such cases the L2 component is necessarily uncorrelated with the L1 component of that variable and the L1 components of all other variables in the model. Therefore, I calculated the 1-1-1 model, splitting each variable's variance into L1 and L2 components and calculated the relationship between the L1 component of x and the L1 component of m, y and z and the relationship between the L2 component of x and the L2 components of m, y and z. Am I right up to this point?
Anyway, in the opinion of the editors from my target journal, x should only be modeled at L2, while m, y, and z should be modeled at both levels. I am asked to report the cross-level interactions between my variables. As this is not the first time that I have been asked to do that, I am wondering if I misunderstood something? Is there a way to neglect the L1-component of x and model only the relationship between the L2-component of x and the L1 and L2 components of m, y and z? If so, could you help me on how I'd have to change my input? Thank you so much in advance!
 Amelie G posted on Wednesday, August 12, 2015 - 2:37 pm
This is my current input("_g" refers to the aggregated values):

within = x m ;
between = x_g m_g ;
cluster = TEAM;
analysis: TYPE=TWOLEVEL RANDOM;
define: center x m (groupmean);
model:
%within%
m on x (aw) ;
y on m (bw)
x ;
z on m (b1w)
x ;
[m@0];
%between%
m_g y z ;
m_g on x_g (a) ;
y on m_g (b)
x_g;
z on m_g (b1)
x_g ;
model constraint:
new (indb indb1 indw indw1);
indb = a*b;
indb1 = a*b1;
indw = aw*bw;
indw1 = aw*b1w;
 Bengt O. Muthen posted on Wednesday, August 12, 2015 - 5:27 pm
What does x represent and why do they want it on between?

Cross-level interactions occur when you have random slopes and that gives rise to a special mediation formula. But random slopes are rare - you can look for one at a time if you like (using s | y on m, for example).
 Janelle Montroy posted on Friday, August 14, 2015 - 2:56 pm
Hello,
can you do a cross level interaction with a latent contextual variable? If so I am not sure how to code.

This is wrong, but something like:
% within
s1| y on x (gamma01);
% between
y on x (gamma10);
s1 on x;
Model constraint:
NEW(betac*);
betac = gamma01 - gamma10;

or would you code the interaction the same way as the latent contextual variable:
% within
y on x (gamma01);
y on x (gamma02);
% between
y on x (gamma10);
y on x (gamma20);

Model constraint:
NEW(betac* betac1);
betac = gamma01 - gamma10;
betac1 = gamma02 - gamma20;

Thank you for your guidance. I just discovered Lüdtke, et al., (2008), and would very much like to utilize this approach.
 Linda K. Muthen posted on Friday, August 14, 2015 - 3:42 pm
You can use a latent variable in a cross-level interaction, for example,

MODEL:
f BY y1-y4; ! latent variable
s | f ON x; ! cross-level interaction
 Janelle Montroy posted on Monday, August 17, 2015 - 6:45 am
Thanks for your response. I don't think my last post was not very clear.

I have a variable representing individual self-regulation, and want to look at its relationship to a literacy indicator. I also want to look at class self-regulation as a predictor of early literacy. My class self-regulation variable would be an aggregate of the individual self-reg. variable. I used example 9.2 to do this by making my self-reg variable a latent contextual variable. Now, I was wondering if there is any way I can look at the interaction of latent level 2 (class) self-reg with individual self-reg to evaluate whether class self-reg affects individuals with different self-reg scores the same way.
Thanks again for all of the help.
 Amelie G posted on Monday, August 17, 2015 - 10:23 am
Hi Ben, thank you so much for your answer! x represents leadership behavior and its effects on employee reactions are analyzed. As x was assessed at L1 (team member ratings), am I right that it would be wrong to only take the aggregated value of x into account?
Moreover, as we also aim to analyze individual reactions to that leadership behavior, I was sure that the 1-1-1 model was the correct one. Do you agree or am I missing something?

If however, I follow the editor's wish and neglect the individual variance in x, would the 2-1-1 model be the model of choice? And in that case - am I right that then no Level 1 mediation effect would or could be modeled?

Are there any other solutions to follow the editor's wish to have x only at L2 while still analyzing its effects on both L1 and L2 variables?
Thanks so much in advance!
 Bengt O. Muthen posted on Monday, August 17, 2015 - 6:35 pm
It's hard for me to say without sinking into the research setting. If you want x->m->y on level 1 you must be thinking that an individual's rating of his/her team leader influences m, y on level 1.

It would be fine to not have a mediation model on level 1.

Even if you don't have a mediation model on level 1 you can estimate the level 1 variance of x. That is, you can do the Mplus latent variable decomposition of x so that x on between is the latent, more reliable, between part of x. The advantage of that is described in the paper on our website:

Lüdtke, O., Marsh, H.W., Robitzsch, A., Trautwein, U., Asparouhov, T., & Muthén, B. (2008). The multilevel latent covariate model: A new, more reliable approach to group-level effects in contextual studies. Psychological Methods, 13, 203-229.
download paper contact first author show abstract
 Bep Uink posted on Wednesday, August 19, 2015 - 9:06 pm
Hello, I have collected ESM data of mood and events (repeated measures nested within person).I have modeled the regression of mood at T+1 on event at T =0. I created a moodT+1 variable on SPPS using SHIFT VALUES command on SPSS which essentially drops each line of data down by one row. Am I correct in assuming that the original mood variable (mood at t = 0) can be used as level 1 co-variate to control for the effects of mood at t = 0. OR does MPLUS aggregate this variable over cluster? Many thanks.
 Bengt O. Muthen posted on Thursday, August 20, 2015 - 6:33 pm
Mplus doesn't aggregate a variable unless you ask for it.

Regarding the general analysis strategy question you may want to ask this on SEMNET.
 Cynthia Yuen posted on Saturday, September 05, 2015 - 7:16 pm
Hello,

I have a couple of multilevel questions that I'm a bit stuck on.

First, I'm trying to run a cross-level model with latent variables but I keep getting the following error:

THE LOGLIKELIHOOD DECREASED IN THE LAST EM ITERATION. CHANGE YOUR MODEL, STARTING VALUES AND/OR THE NUMBER OF INTEGRATION POINTS.

THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ERROR IN THE COMPUTATION. CHANGE YOUR MODEL AND/OR STARTING VALUES.

When I run the model with only a fixed slope (just defining factors A and B in the within model command, then specifying A ON B), the model will converge fine. However, if I allow the slope to be random (b1 | A ON B in the within command), I get this error. Do you know what might be going wrong?

Second, is there a way to groupmean center a latent?

Last, I have a basic question. What is the difference between a model where I put all Level 1 variables in the Variable: Within = section vs. one where I don't? For example:

VARIABLE:
...
Within = DV1-DV4 IV1-IV4;
Between =;
MODEL:
%Within%
DV BY DV1-DV4;
IV BY IV1-IV4;
b1 | IV ON DV;
...

vs.

VARIABLE:
...
Within = IV1-IV4;
Between =;
MODEL:
%Within%
DV BY DV1-DV4;
IV BY IV1-IV4;
b1 | IV ON DV;

Thank you very much!
...
 Linda K. Muthen posted on Sunday, September 06, 2015 - 11:43 am
1. The effect may not be random. Loot at the variances in the partial results. Or you may need more integration points.

2. This cannot be done. The means of latent variables are most often zero.

3. If you put variables on the WITHIN list, there is no variability on between. If you don't, there is.
 Cynthia Yuen posted on Tuesday, September 08, 2015 - 4:42 pm
Thanks much for the speedy response!

I wasn't completely sure what partial results referred to but the model results following the error I pasted in my original message says that the variance of b1 is 28.387. However, I have no idea what metric I should be comparing that against and whether this is meaningful. If it helps at all, when I run the model with the latents as an observed average of their indicators, the variance of the path is highly significant.

I'm also extremely new to cross-level models, especially with latents, so would it be possible for you to explain what integration parts are/do or direct me to a source where I could get a better basic understanding? Thank you!
 Bengt O. Muthen posted on Tuesday, September 08, 2015 - 6:04 pm
Please send your output, data, and license number to support so we can see what's going on.
 Jasmin Jin posted on Monday, October 12, 2015 - 5:56 am
Hello,
I think my problem is related on this board. So I'm posting questions. My model is a multilevel SEM(2-level). I also want to research cross-level effects. I read chapter 9 in user¡¯s guide and make the following code but it has errors. I appreciate your checking.

VARIABLE:
NAMES ARE hw01-hw07 a01-a08
SLS achi01-achi05 t_clus;
USEVARIABLES ARE hw03-hw07 a05-a08
SLS achi01-achi05 t_clus;
BETWEEN = hw03-hw07 a05-a08;
CLUSTER = t_clus;

ANALYSIS: TYPE = TWOLEVEL RANDOM;
ALGORITHM = INTEGRATION;
INTEGRATION = 10;

MODEL:
%WITHIN%
s1 | achi01-achi05 ON SLS;
%BETWEEN%
t_hw by hw03-hw07;
t_as by a05-a08;
s_SLS by SLS;
SLS@0;
achi01-achi05 s1 s_SLS ON t_hw t_as;


*** WARNING in MODEL command
In the MODEL command, the following variable is a y-variable on the BETWEEN
level and an x-variable on the WITHIN level. This variable will be treated
as a y-variable on both levels: SLS
1 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS
 Linda K. Muthen posted on Monday, October 12, 2015 - 10:26 am
This is an informational warning not an error. You analysis should have gone on.
 Jasmin Jin posted on Monday, October 12, 2015 - 3:34 pm
Dear Ms. Muthen

Thank you for quick answering.

I have more questions. There is only estimates in the output - no model fit information, s.e. and p-value. Do you mind if I ask you the reason?
 Linda K. Muthen posted on Monday, October 12, 2015 - 4:53 pm
It sounds like the model did not converge. Please send the output and your license number to support@statmodel.com.
 Francesco Montani posted on Monday, February 01, 2016 - 3:06 am
Dear Linda/Bengt,

I am conducting a cross-level interaction analysis with the following variables:

- Level-1 independent variable (observed variable) = IV (age)
- Level-2 dependent variable (observed variable) = DV (work unit absenteeism)
- Level-2 moderator (latent variable) = M1-M5 (team climate items loading on the level-2 moderator)

Could you please tell me if the following syntax is correct?

USEVARIABLES ARE
IV
DV
M1
M2
M3
M4
M5
prov;
CLUSTER IS prov;
BETWEEN ARE
M
DV;

ANALYSIS: TYPE IS TWOLEVEL RANDOM; ALGORITHM=INTEGRATION; INTEGRATION = MONTECARLO;

MODEL:
%BETWEEN%
M BY
M1
M2
M3
M4
M5;
IVb by
IV;
IV@0;
DV ON M IVb;
beta1 | DV ON IVb;
beta1(gam0);
beta1 ON M (gam1);

MODEL CONSTRAINT:
New (ylow yhigh);
ylow = (gam0+gam1*(-1.89));
yhigh = (gam0+gam1*1.89);

OUTPUT: STDYX TECH1 TECH3 TECH8 CINTERVAL;

Thanks a lot in advance,

Francesco
 Bengt O. Muthen posted on Monday, February 01, 2016 - 6:18 pm
Looks like you are doing two-level to get a latent variable decomposition of your IV. Make sure you get its variance estimated on Within as well.

But you cannot use a random slope construction on Between. It has to be defined on a level below the highest.
 Francesco Montani posted on Monday, February 01, 2016 - 11:31 pm
Dear Bengt,

Thank you so much for your kind and helpful reply.
Concerning your second point, however, I was wondering how I can construct the random slope at the level below the highest, when my DV can only be defined at the between-level..
Could you please give me an idea of how to adddress this issue in my syntax?

Thanks a lot in advance.
 Bengt O. Muthen posted on Tuesday, February 02, 2016 - 5:43 pm
It isn't possible in Mplus, or other multilevel programs, to have a random slope vary on its own level so to speak. Your random slope refers to a Level-2 relationship so you would need a third level across which units this slope varies.

An exception in Mplus is UG ex 3.9, which has a single-level model with a random slope. But that is a special kind of heteroscedasticity modeling that I have not seen carried out in a multilevel setting.
 Kristin Gainey posted on Thursday, February 04, 2016 - 7:46 am
I have two variables that vary at both the within and between level. I would like to form a within-level observed interaction term from these variables, and then examine both the within and between variance of this interaction term as predictors of an outcome. Is the following syntax correct, or would the specification be more complex?

%WITHIN%
y on x z x*z;

%BETWEEN%
y on x z x*z;

Thank you for your help!
 Linda K. Muthen posted on Thursday, February 04, 2016 - 10:43 am
For observed variables, an interaction term is created using the DEFINE command, for example,

DEFINE:
xz = x*z;

Then put xz at the end of the USEVARIABLES list and use it in the MODEL command.
 anonymous Z posted on Friday, February 12, 2016 - 7:59 am
Dear Drs. Muthen,

I am fitting a two-part model by using a multilevel approach to model longitudinal trajectory. “AL” is my outcome variable across five time points. X is a time varying covariate across five time points. TX is treatment status. I want to create a cross-level interaction between baseline value of X and TX (i.e., TX * baseline value of X), and see how TX*baseline value of X influences time slope. I have a couple of questions:
1. How to specify the baseline value of X?
2. How should I create the interaction term?
3. Should I put the interaction term in the place of “between” or “within”

Thanks so much!

DATA TWOPART:
NAMES = AL;
BINARY = binAL;
CONTINUOUS = contAL;
VARIABLE: NAMES ARE ID TX time X AL;

USEVARIABLES ARE ID TX binAL contAL;

CATEGORICAL ARE binAL;

MISSING = ALL (-999999);

cluster = ID;
within = time X;
Between = TX;
Analysis:
type = twolevel random;


MODEL:
%within%
S1| BinAL on time;
BinAL ON X;

S2| ContAL on time;
ContAL ON X;

%between%
BinAL ON TX;
S1 ON TX;
BinAL with S1;

ContAL ON TX;
S2 ON TX;
ContAL WITH S2;
 Bengt O. Muthen posted on Friday, February 12, 2016 - 5:11 pm
1.You just have a column in your data with a baseline value that is the same across the time points for an individual.

2.Use Define to create TX*Base and declare that as a Between variable since Between refers to subject.

3. Between
 Selin Kudret posted on Thursday, February 25, 2016 - 7:49 am
Dear Linda and Bengt

On a cross-level interaction plot produced by MPlus, I would like to swap the L1 predictor and L2 moderator, so that I would see and interpret the alternative symmetrical result of the L1 variable being the moderator and L2 variable being the predictor. I was wondering how I could ask the cross-level interaction plot in this way.

Many thanks and best wishes
 Bengt O. Muthen posted on Thursday, February 25, 2016 - 6:27 pm
What is your Within model in this case?

See also

http://www.statmodel.com/download/Cross-level%20effect%20plotted%20by%20LOOP.pdf
 Selin Kudret posted on Friday, February 26, 2016 - 3:30 am
Dear Bengt

My model is as follows. In this code, the plot command produces an interaction plot wherein L1x is the predictor, L2w the moderator, and y the outcome. My aim is to get a plot wherein L2w is the predictor and L1x is the moderator.

I've been using a different plot command than the one you shared with the link. As you suggested, I also tried the PLOT (crosslvl) command and don't seem to be able to swap L2w for L1x. It seems to me that crosslvl and mod are labels - crosslvl indicating the outcome y and mod referring to moderator L2w. Hence, simply replacing the mod label doesn't seem to produce a symmetrical interaction plot.

Many thanks for your help, best wishes.

MODEL:
%WITHIN%
S | y ON L1x;

%BETWEEN%
y ON L2w;
y WITH S;
S;
[S] (b0);
S ON L2w (b1);

MODEL CONSTRAINT:
PLOT(LOMOD HIMOD);
LOOP(XAXIS,-3,3,0.1);
LOMOD = (b0 + b1*1)*XAXIS;
HIMOD = (b0 + b1*5)*XAXIS;

PLOT:
TYPE = plot2;
 Bengt O. Muthen posted on Friday, February 26, 2016 - 6:50 am
In your code L2w is a between-level variable and L1x is a within-level variable. So L2w can't take the role of L1x on Within and L1x can't take the role of L2x on Between. But maybe I am misunderstanding you.
 Selin Kudret posted on Friday, February 26, 2016 - 7:50 am
Dear Bengt

Many thanks; you understand my point correctly. In fact, what I am trying to do features in the Aguinis, Gottfredson, and Culpepper paper (p.1514): "..can we say that the L2 variable moderates the effect of the L1 predictor on the L1 criterion and, also, that the L1 predictor moderates the effect of the L2 predictor on the L1 criterion? From a statistical standpoint, it is just as appropriate to label the L2 predictor as the moderator of the effect of the L1 predictor X on the L1 outcome Y as it is to label the L1 predictor X as the moderator of the effect of the L2 predictor W on the L1 outcome Y because cross-level interactions are symmetrical."

I'd like to plot the cross-level interaction in the way I described because of conceptual reasons. My cross-level hypothesis makes much more sense with L1x as the moderator. The way we set up cross-level interactions in MPlus, i.e. creating the latent variable S to represent a within relationship and explaining it by a between variable, lends itself into a plot where we always have the L2 variable as the moderator. Hence, the symmetrical version is likely to require an alternative set-up of the cross-level interaction in the model command, which I was not able to figure out. If that's somehow possible in MPlus, I would appreciate your help.

Many thanks for your time, best wishes.
 Bengt O. Muthen posted on Friday, February 26, 2016 - 3:02 pm
You can do it this way I think.

Drop the random slope. Create a cluster mean variable for L1X, say L1XM declared as a between variable. Then on Between drop all the random slope references and instead have only

y ON L1XM L2W Inter;

where Inter is created in Define as L2W*L1XM.
 Arie Zakaryan posted on Wednesday, March 09, 2016 - 11:59 pm
Hello!
I wanted to ask:
Is it possible to create a cross-level interaction term from 2 latent variables (one on the between-level and one on the within-in)?
It seems when discussing the cross-level interactions most people are either discussing observed variables on either level or perhaps only one latent variable and one observed.
My apologies if the answer was in this forum and I couldn't find it (or if it involves something obvious that I should already know). Thank you in advance!
 Linda K. Muthen posted on Thursday, March 10, 2016 - 7:19 am
The variable involved in a cross-level interaction can be observed or latent. Follow Example 9.2 but use latent variables.
 Timothy Allen posted on Thursday, March 31, 2016 - 10:17 am
Hi,

I'm having a little trouble understanding cross-level interactions. I'm interested in a random intercepts model where a family-level covariate interacts with a individual-level covariate-- and I'm specifically interested in whether the interaction between the covariates explains variance across individuals (not families) in my DV. All variables are observed. It seems like the approach recommended here is using syntax such as:

CLUSTER = clus;
ANALYSIS: TYPE = TWOLEVEL;
MODEL:
%WITHIN%
S | y ON x;
%BETWEEN%
S ON w;

I'm wondering how that syntax is interpreted differently than if I created an interaction term using DEFINE for x and w, and then used the following syntax:

CLUSTER = clus;
ANALYSIS: TYPE = TWOLEVEL;
MODEL:
%WITHIN%
y on x;
y on xw;
%BETWEEN%
y ON w;


Thanks,
 Bengt O. Muthen posted on Thursday, March 31, 2016 - 3:20 pm
The second alternative is fine but doesn't allow the residual that you have in s ON w in the first alternative.
 Linda K. Muthen posted on Thursday, March 31, 2016 - 4:11 pm
Slide 45 of the Topic 7 course handout on the website shows the formulas related to you first syntax. This is the correct sytax for cross-level interactions.

The second syntax is not allowed if x is on the WITHIN list and w is on the BETWEEN list.
 Annamaria Kubovcikova posted on Monday, April 11, 2016 - 2:26 pm
Hello,

I am fitting multi-level SEM, since I have ego-alter data. Ego is the individual, who has rated up to 5 alters. I would like to add moderated mediation, where the mediation is within (1-1-1) and the moderator is between. But I would like to moderate the first part of mediation so if my mediation is
x (a friend is international or not) mediator (frequency of socialization)
y1 (work support)
y2 (emotional support)
moderator (ego's ability to speak foreign language)

What do I do? Does this seem reasonable?
Within= x;
Between= moderator;
MISSING ARE ALL (-9999);
CLUSTER IS nid;
DEFINE:
Center x moderator (grandmean);
ANALYSIS:
TYPE IS TWOLEVEL RANDOM;
Model:
%BETWEEN%
S on moderator;
%WITHIN%
y1 on mediator;
y2 on mediator;
S | mediator on x;

Does that sound reasonable?
What if I would like to add the y1 and y2 on the between level, would S-the random slope have to be a predictor of y1 and y2 on the between level?

Thank you
Annamaria
 Bengt O. Muthen posted on Monday, April 11, 2016 - 6:37 pm
Q1. Yes.

Q2. Perhaps just correlated.
 Jenna E Finch posted on Wednesday, September 21, 2016 - 3:27 pm
Dear Linda and Bengt,

We are having trouble finding syntax for a cross-level interaction that fits our specific model.

Our predictor (X) is a L2 variable (classroom quality), our outcome (Y) is a L1 variable (child outcome), and our moderator (M) is a L1 variable (child initial skills).

We also had a question about whether it was important for us to grand or group-mean center our variables.

Any advice you have on centering and syntax for a cross-level interaction where the moderator and outcome are L1 and the predictor is L2, would be greatly appreciated!

All the best,
Jenna
 Bengt O. Muthen posted on Wednesday, September 21, 2016 - 5:27 pm
In the Variable command, say

Between = x;
Within = m;

and in the Model command, say:

%within%
s | y on m;

%between%
y s on x;

This creates an interaction effect from m*x.

Regarding centering, see the Topic 7 handout from our short courses on our website, slides 31-43.
 Philipp Jugert posted on Tuesday, November 22, 2016 - 3:07 am
I have a followup question to Selin Kudret's Feb 26 post and Bengt's answer. What if my L1 moderator is binary rather than continuous? In that case it doesn't seem to make sense to compute a cluster mean variable. Any help would be appreciated.
 Bengt O. Muthen posted on Tuesday, November 22, 2016 - 5:23 pm
The cluster mean will then be a proportion which is perfectly fine for capturing a between effect.
 Nitya Chawla posted on Tuesday, January 03, 2017 - 8:17 pm
Hi!

I have a 2-1-2-2 model, with the 1-2 path moderated by another Level 2 variable. In order, my L2 variables are Cond, PC, and IS. My L1 variable is AS, and the L2 moderator is PFB.

While I'm able to write the syntax for the basic 2-1-2-2 model, I'm unable to figure out the cross-level interaction that has a Level 2 dependent variable.
Am I correct in creating the interaction term between the Level 1 and Level 2 variables (Int = AS * PFB) in the dataset, and then using this term as the variable to predict the L2 variable?

Here's the syntax I have thus far:

CLUSTER = Team;

MISSING = all(999.00);

USEVARIABLES = Cond AS PFB Int PC IS ;

BETWEEN = Cond ;

ANALYSIS:
TYPE IS TWOLEVEL RANDOM;

MODEL:

%within%
AS;

%between%
AS ON Cond;
PC ON AS;

PC ON Int;
PC ON PFB;
PC ON Cond;

IS on PC;

Thank you very much, and Happy New Year!
 Bengt O. Muthen posted on Wednesday, January 04, 2017 - 12:09 pm
Create the interaction using the cluster mean for AS so that it is a Level-2 variable.
 Nitya Chawla posted on Thursday, January 05, 2017 - 3:05 pm
That makes sense – thank you!
 Rebecca Lazarides posted on Sunday, January 15, 2017 - 9:16 am
Hi,
I would like to test whether the relation between a level-1 x- variable (gender) and a level-1 y-variable (individual's motivation) is moderated by a level-2 m- variable (context variable). In example no. 9.2 of the user guide, the y variable is decomposed and also modelled at level 2. However, I am not sure whether this syntax applies to my research question as I am interested in the relationship between two level-1 variables and whether it is moderated by a level-2 moderator. Would this syntax be correct for my research question?

within= x y;
between= m;

%within%
slope|y on x;

%between%
slope on m;

Or do I need to exclude y from the "within =" part?

Thank you very much for your help.
 Linda K. Muthen posted on Sunday, January 15, 2017 - 9:55 am
You should not put y on the within list if it is used for a random slope. See slide 45 of the Topic 7 course handout on the website to see the formulas for this specification.
 Rebecca Lazarides posted on Sunday, January 15, 2017 - 10:45 am
According to example 9.8 in the user's guide I now modelled

within= x;
between= m1 m2 m3;

%within%
Wfy by y1 y2 y3;
slope|Wfy on x;

%between%
fm by m1 m2 m3;
Bfy by y1 y2 y3;
y1-y3@0;

slope on fm;

However, I still get an error message.

THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO A CHANGE IN THE
LOGLIKELIHOOD DURING THE LAST E STEP.

AN INSUFFICENT NUMBER OF E STEP ITERATIONS MAY HAVE BEEN USED. INCREASE
THE NUMBER OF MITERATIONS OR INCREASE THE MCONVERGENCE VALUE. ESTIMATES CANNOT BE TRUSTED. SLOW CONVERGENCE DUE TO PARAMETER 28.
 Rebecca Lazarides posted on Sunday, January 15, 2017 - 10:46 am
sorry, not "still" - I just get an error message. How can I solve this problem? Thank you!
 Linda K. Muthen posted on Sunday, January 15, 2017 - 11:01 am
Please send the output and your license number to support@statmodel.com.
 Belen Tena posted on Friday, January 20, 2017 - 1:28 am
This is a follow up question regarding the answer to the question posted by Selin Kudret on Friday, February 26, 2016, regarding a cross-level hypothesis with a L2 predictor (L2W), a L1 criterion (y) and a L1 moderator (L1x). This researcher used a random slope to estimate the interaction.

The suggestion was ( Bengt O. Muthen posted on Friday, February 26, 2016 - 3:02 pm):

"You can do it this way I think.
Drop the random slope. Create a cluster mean variable for L1X, say L1XM declared as a between variable. Then on Between drop all the random slope references and instead have only
y ON L1XM L2W Inter;
where Inter is created in Define as L2W*L1X".

I wonder if you can give us a reference paper or book to justify this procedure to estimate this kind of interaction.
Thanks
 Bengt O. Muthen posted on Friday, January 20, 2017 - 1:14 pm
Perhaps it is discussed in the Raudenbush-Bryk multilevel book.
 Bèiendé Niú posted on Wednesday, February 15, 2017 - 2:42 am
I’d like to request some help with the following example. I have a sample of international subsidiaries (level 1) which belong to different companies (level 2a) and are located across several host countries (level 2b). Each subsidiary’s performance (sub_perf) is affected by characteristics of the host country (say the regulatory environment e.g. the contry's “Ease of using business index”; reg_env) and by the company’s characteristics (say international experience; int_exp). So far that is no problem.
However, what do I do to test the following interaction: For companies with a higher international experience the (negative) effect of a difficult regulatory environment on subsidiary performance is weaker than for those with less international experience? My first attempt was this:

CLUSTER = country company;
BETWEEN = (country) reg_env (company) int_exp;
ANALYSIS: TYPE = CROSSCLASSIFIED RANDOM; ESTIMATOR = BAYES;
MODEL:
%BETWEEN country%
s | sub_perf ON reg_env;
%BETWEEN company%
sub_perf ON int_exp;
s ON int_exp;

Of course in this case the output tells me, that “Random effect variables cannot be declared on level COUNTRY_NR”. Is there any option for modelling this?
 Bèiendé Niú posted on Wednesday, February 15, 2017 - 3:50 am
I am sorry for posting again, however I just though of a different idea, regarding the above example.

Does it make any sense to use the define command to generate an interaction term and then including it on the WITHIN Level, i.e.:

CLUSTER = country company;
WITHIN = interaction;
BETWEEN = (country) reg_env (company) int_exp;
DEFINE: interaction = reg_env * int_exp;
ANALYSIS: TYPE = CROSSCLASSIFIED;
ESTIMATOR = BAYES;
MODEL:
%WITHIN%
sub_perf ON interaction;
%BETWEEN country%
sub_perf ON reg_env;
%BETWEEN company%
sub_perf ON int_exp;

The models runs normally with this specification, but does it even make sense?
 Filippo Temporin posted on Wednesday, February 15, 2017 - 9:24 am
Dear Bengt/Linda,
I am fitting a two-level SEM. The outcome variable is a count variable (d), the model takes the form of a piecewise exponential model (or better its Poisson equivalent).
The latent variable DEPR is defined at level 2.
I would like to fit the model including a cross-level interaction DEPR_pnm between DEPR and the dummy per_pnm defined at level 1.

I came out with this (using runmplus in stata), is this the right approach? Thanks!


analysis(TYPE = TWOLEVEL RANDOM;)///
model( ///
%WITHIN%///
DEPR_pnm | d ON per_pnm; ///
%BETWEEN%///
DEPR BY v1-v7; ///
DEPR_pnm ON DEPR; ///
DEPR_pnm@0; ///
d ON DEPR;)
 Bengt O. Muthen posted on Wednesday, February 15, 2017 - 3:04 pm
Answer to Temporin:

This looks correct, but you don't have to fix the residual variance at zero on the Between level.
 Bèiendé Niú posted on Thursday, February 16, 2017 - 7:55 am
Sorry, have I made any mistake with my previous post or have you simply overlooked it because Filippo Temporin posted after me?
 Bengt O. Muthen posted on Thursday, February 16, 2017 - 8:49 am
Your post is not overlooked but will be answered before too long.
 Tihomir Asparouhov posted on Thursday, February 16, 2017 - 2:28 pm
Here is the answer to Bèiendé Niú

Try this command
CLUSTER = company country;
instead of
CLUSTER = country company;

Also take a look at User's Guide example 9.26
 Bèiendé Niú posted on Friday, February 17, 2017 - 1:25 am
Thanks for the reply. Indeed changing the sequence of the clusters apparently gets me a step further.

Still:
"Observed variable on the right-hand side of a between-level ON statement for a random slope cannot be a BETWEEN variable for TYPE=CROSSCLASSIFIED"

I think the problem is still the same, because I am interessted in the interaction beween two BETWEEN level variables. I assume this doesn't work either way in crossclassified.

Are there any thoughts on the second idea I posted, i.e. including an ON statement with an interaction term (of both BETWEEN-level variables) on the WITHIN level? The estimation runs smoothely, but I am still not sure whether the results from such an approch are any meaningful. Am I somehow cutting corners with that?
 Tihomir Asparouhov posted on Friday, February 17, 2017 - 3:04 pm
That variable is a covariate so you can specify it as a within. The order of the clusters is not important either. My reference to 9.26 is not appropriate since 9.26 has interactions of two-latent variables (which needs a special order of the cluster variables).

The model with
DEFINE: interaction = reg_env * int_exp;
is totally fine.


CLUSTER = country company;
BETWEEN = (company) int_exp;
ANALYSIS: TYPE = CROSSCLASSIFIED RANDOM; ESTIMATOR = BAYES;
MODEL:
%WITHIN%
s | sub_perf ON reg_env;
%BETWEEN country%
s@0; sub_perf;
%BETWEEN company%
sub_perf ON int_exp;
s ON int_exp;
 Lauren Molloy Elreda posted on Wednesday, July 05, 2017 - 1:18 pm
Hi,

I'm trying to plot my significant cross level interaction using preacher's calculator. I've requested TECH1 in the output to identify the parameter numbers, and TECH3 in the output to get the coefficient covariances. However, I'm only finding parameter numbers for the within-level coefficients. The parameter number for the intercept is showing up (in the alpha matrix) as 0, and all of the between-level coefficient parameter numbers are showing up (in the beta matrix) as 0 as well. Are there different matrices I'm supposed to be looking at in tech1 to find the parameter numbers for the intercept and for the between-level effects?

Thank you in advance!
Lauren
 Linda K. Muthen posted on Wednesday, July 05, 2017 - 1:51 pm
Please send the output and your license number to support@statmodel.com.
 dummyvariable123 posted on Sunday, November 12, 2017 - 6:18 am
Hello,

I am trying to model a cross-level interaction (L1 within persons, L2 between persons) where L2 variable "Z_mean" (mean of "Z" over 3 waves = time invariant, grand mean centered) interacts ("Inter") with L1 time-varying predictor "X" (person mean centered) of L1 time-varying DV "Y" (uncentered).

I specified it as:

within = wave0 X inter Qwave;
between = Z_mean;
ANALYSIS:
TYPE = COMPLEX TWOLEVEL;

MODEL:

%within%
Y ON wave0 Qwave;
Y ON X;
Y ON Inter;

%between%
Y ON Z_mean;

"Inter" is negative and significant. Is it correct to say that Z_mean moderates the L1 relation between X and Y (i.e. that effect of X ON Y is smaller for those higher in Z_mean)?

Thank you in advance!
 Bengt O. Muthen posted on Sunday, November 12, 2017 - 5:40 pm
That interpretation seems correct. But cross-level interactions are more commonly done via random slopes:

s | y on x;

so that on Between you have

y s on z_mean;
 dummyvariable123 posted on Monday, November 13, 2017 - 12:45 am
Thank you for your quick response. The random slopes method is more common but is the above method correct as well?

I am interested only in fixed effects of X. It also does not have a significant random slope so doing it via random slope gives insignificant results.

I would appreciate your guidance.
 Bengt O. Muthen posted on Monday, November 13, 2017 - 3:43 pm
Q1: yes.

But if a Level 2 moderator like your Z_mean interacts with a level 1 covariate, this means that there is variation in the slope over between-level units. The two are not different things - if you don't have a significant random slope it would seem that you don't have a significant interaction.
 Jan posted on Tuesday, November 14, 2017 - 12:28 am
Dear Dr Muthen, in your messaged posted on: Sunday, July 22, 2012 - 9:50 am

you suggested that covariances of residuals on the between level need to be included if there are several outcomes on the between level.
My model runs without these covariances, but when they are entered this message occurs under MLR:

MAXIMUM LOG-LIKELIHOOD VALUE FOR THE UNRESTRICTED (H1) MODEL IS -406.704

THE MODEL ESTIMATION DID NOT TERMINATE NORMALLY DUE TO AN ILL-CONDITIONED
FISHER INFORMATION MATRIX. CHANGE YOUR MODEL AND/OR STARTING VALUES.

The model works though with Bayes, but the MLR is preferred.
My question is whether estimates are still correctly interpretable when those covariances are not included?
 dummyvariable123 posted on Tuesday, November 14, 2017 - 12:35 am
If they are not different things and both are correct then why my random slope (variance) is not significant.....:

Between Level
Means
Y 2.249 0.035 63.893 0.000
Slope 0.106 0.080 1.330 0.184
Variances
Y 0.224 0.028 8.021 0.000
Slope 0.027 0.131 0.209 0.835

...and neither is the moderation via random slope:

Between Level
Slope ON Z_mean -0.670 0.476 -1.408 0.159
Means
Y 2.259 0.036 63.596 0.000
Intercepts
Slope 0.083 0.083 0.997 0.319
Variances
Y 0.229 0.028 8.166 0.000
Residual Variances
Slope 0.078 0.159 0.489 0.625

.....while the interaction the way I specified it in my previous post is significant:

Between Level
Y ON Z_mean -0.460 0.182 -2.524 0.012
Intercepts
Y 2.257 0.035 63.955 0.000
Residual Variances
Y 0.222 0.027 8.136 0.000
 dummyvariable123 posted on Tuesday, November 14, 2017 - 12:49 am
Apologies but I did not include interaction results above. They are:

Within Level
Y ON
WAVE0 0.215 0.075 2.860 0.004
QWAVE -0.138 0.035 -3.989 0.000
X 0.089 0.061 1.451 0.147
INTER -0.636 0.296 -2.147 0.032
Residual Variances
Y 0.290 0.020 14.720 0.000

Between Level
Y ON Z_mean -0.460 0.186 -2.471 0.013
Intercepts
Y 2.257 0.044 51.386 0.000
Residual Variances
Y 0.222 0.024 9.411 0.000

Could the difference be caused by using Twolevel Random in the moderation via random slope and Complex Twolevel in this moderation?
 Bengt O. Muthen posted on Wednesday, November 15, 2017 - 10:37 am
Answer to Jan:

Send your output to Support along with your license number.
 Bengt O. Muthen posted on Wednesday, November 15, 2017 - 10:38 am
Answer to dummyvariable123:

Send both outputs to Support along with your license number.
 Bengt O. Muthen posted on Wednesday, November 15, 2017 - 10:39 am
Dummyvariable123:

And, yes, the difference can be caused by using Twolevel Random in the moderation via random slope and Complex Twolevel in this moderation.
 Marc OHANA posted on Thursday, November 16, 2017 - 8:44 am
Dear Bengt/Linda,
I am testing a two levels model with two interactions :
- a first one which is a cross level interaction involving the WL2 moderator and the within part of X
- a second one involving the WL2 moderator and the between part of X (X climate).
I have difficulties to test the second interaction. Am I correct with this syntax ?

BETWEEN ARE WL2;

ANALYSIS:
TYPE IS TWOLEVEL RANDOM;

DEFINE:
INT = X*WL2;

MODEL:
%WITHIN%
S | Y ON X;

%BETWEEN%
S ON WL2; !cross level interaction involving the WL2 moderator and the within part of X
Y ON X WL2 INT ; ! interaction at level 2 involving the WL2 moderator and the between part of X (X climate).

Thank you for your help
Marc
 Bengt O. Muthen posted on Thursday, November 16, 2017 - 3:41 pm
Just create a cluster-mean version of X to and create the product of that and WL2. Use the option CLUSTER_MEAN.
 Dorien Sampermans posted on Wednesday, January 17, 2018 - 3:50 am
I am writing a paper on how 'teaching and learning practices' can influence students civic knowledge pv1civ (next stap is to observe all plausible values, not yet done is this analysis).
I found interesting results and a random slope (differences in vocational and general track = multilevel interaction STROOM) while running the analyses observing the influence of 'opportunities to participation (SPART)'. But what does Mplus do when I give more teaching and learning practices in the input (SPART, OPD, and CVLN)? Does Mplus make a sum of these variables? Because I get a similar output as when I only observe SPART (only different results)

Part of my syntax:

Usevariables are age gender hisei imm pv1civ stroom, cvln, sopd, spart, wl1, wl2;
Missing are all (-999);
WEIGHT IS wl1;
BWEIGHT IS wl2;
cluster is idsch;
between= stroom ;
within= cvln sopd spart age gender hisei imm;
DEFINE: center cvln sopd spart (Grandmean);
ANALYSIS: type=twolevel random;

Model:

%within%
pv1civ on age gender hisei imm;
s | pv1civ on cvln sopd spart ;

%Between%
pv1civ on stroom ;
[s];
s on stroom ;

OUTPUT: TECH8 TECH4 SAMPSTAT;
 Bengt O. Muthen posted on Wednesday, January 17, 2018 - 11:43 am
We need to see the full output for the 2 runs you refer to - send to Support along with your license number.
 Sunil Sahadev posted on Wednesday, January 17, 2018 - 4:50 pm
I am running a multilevel regression with a three way interaction term. two variables: x1 and x2 are level 1 variables and z1 is a level two variable. Hence in my equation i will have one of the IVs the term x1*x2*z1. I would like to know how do I plot the result through the loop command. Can you point me towards any code which i can use.
 Bengt O. Muthen posted on Wednesday, January 17, 2018 - 5:09 pm
Do you have a random slope for the x1*x2 interaction predictor on Level 1? And that random slope is regressed on z1 on Level 2?
 Sunil Sahadev posted on Thursday, January 18, 2018 - 2:19 am
No I am not proposing a random slope. The x1*x2, x1*z1 and x*x2*z1 will only have a fixed slopes at Level1
 Bengt O. Muthen posted on Thursday, January 18, 2018 - 12:10 pm
Then just pick some representative values of z1 (such as the mean and 1 SD away from the mean) and do the regular plot using the interaction between the two x's conditional on that z1 value.
 CHEN CHEN posted on Friday, March 23, 2018 - 10:40 pm
Dear Dr. Muthen,
I am running a 1-2-1 moderating model, the moderator is a city-level variable, and have two questions:
(1)can I use the z score of the moderator computed in the spss data set, instead of using the define:center w(grand) command? Is there any difference between these two methods?
(2)the ICC is quite low, only 0.038, but the cluster size is 314, is it ok to use the multilevel model?
Thanks a lot!
 Bengt O. Muthen posted on Saturday, March 24, 2018 - 11:38 am
1) You can, although z scores are standardized values while grandmean centering simply subtracts the mean, not dividing by the SD.

2) Yes.
 Javed Ashraf posted on Thursday, September 06, 2018 - 7:02 am
Dear Muthens
I am getting a constant error in the DEFINE command, can you please guide where is the error, also if my method is correct or not:
USEVARIABLE ARE MP_TL MP_TR MP_ML MP_MR
Sym_LBP Symp_My
Mig_M Gender Med_ODA Fs_Hb1C GROUP;

GROUPING IS GROUP(1=MALE_CONTROLLED_DIABETICS 2=MALE_UNCONTROLLED_DIABETIC
3=MALE_CONTROLLED_NONDIABETIC 4=MALE_UNCONTROLLED_DIABETIC
5=FEMALE_CONTROLLED_DIABETICS 6=FEMALE_UNCONTROLLED_DIABETIC
7=FEMALE_CONTROLLED_NONDIABETIC 8=FEMALE_UNCONTROLLED_DIABETIC);

MISSING ARE ALL(-999);

DEFINE:
IF
Gender EQ 1 AND Med_ODA EQ 1 AND Fs_Hb1C < 7 THEN group = 1;;
Gender EQ 1 AND Med_ODA EQ 1 AND Fs_Hb1C >= 7 THEN group =2;
Gender EQ 1 AND Med_ODA EQ 0 AND Fs_Hb1C < 7 THEN group =3;
Gender EQ 1 AND Med_ODA EQ 0 AND Fs_Hb1C >= 7 THEN group =4;
Gender EQ 2 AND Med_ODA EQ 1 AND Fs_Hb1C < 7 THEN group = 5;;
Gender EQ 2 AND Med_ODA EQ 1 AND Fs_Hb1C >= 7 THEN group =6;
Gender EQ 2 AND Med_ODA EQ 0 AND Fs_Hb1C < 7 THEN group =7;
Gender EQ 2 AND Med_ODA EQ 0 AND Fs_Hb1C >= 7 THEN group =8;
*** ERROR in DEFINE command
Error in assignment statement for GENDER
 Linda K. Muthen posted on Thursday, September 06, 2018 - 1:58 pm
Try

DEFINE:
IF (Gender EQ 1 AND Med_ODA EQ 1 AND Fs_Hb1C < 7) THEN group = 1;;
If (Gender EQ 1 AND Med_ODA EQ 1 AND Fs_Hb1C >= 7) THEN group =2;

ETC.
 Sandra Ohly posted on Wednesday, August 28, 2019 - 12:24 am
My PhD student calculated a cross-level interaction in a cross-lagged design, using type=twolevel, and MLR estimation. When she adds syntax to get graphics of the slopes of the interaction effect, the standard error of the interaction effect is suddenly twice the size, and the associated coefficient is no longer significant. So we wonder why this might be? Does it have to do that she uses ALGORITHM = Integration?
 Bengt O. Muthen posted on Wednesday, August 28, 2019 - 3:09 pm
We need to see both outputs - send to Support along with your license number.
 Eftychia Stamkou posted on Thursday, September 19, 2019 - 12:15 pm
Hello,

I run a multilevel logistic regression model where a nominal variable (with 3 levels) is regressed on two continuous between-level variables, an interaction term of the between-level variables, and four within level variables (control variables).

Results show a significant effect of the first between-level variable and the interaction term. Both of these effects have a negative sign. I managed to plot and interpret the main effect but I am struggling with the interaction effect.

1) How do I interpret the significant interaction term?
2) Is there a way to plot the interaction?

Thank you!
 Bengt O. Muthen posted on Saturday, September 21, 2019 - 11:34 am
1) Just like in regular regression.

2) Yes. See e.g. the Table 1.8 scripts for our RMA book at

http://www.statmodel.com/mplusbook/chapter1.shtml
 anonymous posted on Friday, December 13, 2019 - 2:05 pm
Hello.

1. Do you know if this below model can determine whether there is cross-level interaction effects between the class-average achievement and individual achievement on individuals' affects (contextual, grand-mean).

2. For example, wouldn't a significant effect mean (s insignificant) that this effect is similar for all levels of academic achievement. Or am I wrong?
---

Mplus interaction model:

within= ACH;
between= ACHA;

Define:
ACHA=cluster_mean(ACH);
center ACH (grandmean);

ANALYSIS:
TYPE = twolevel random;
estimator=mlr;

MODEL:
%WITHIN%
inw by x1 (1)
x2 (2)
x3 (3);
s| inw on ACH;

%BETWEEN%
inb by x1 (1)
x2 (2)
x3 (3);

inb on ACHA;
inb on s;
 anonymous posted on Saturday, December 14, 2019 - 4:22 am
Hello.

1. Above, I actually wondering if Mplus could test an cross-level interaction where the individual's achievement were as a moderator?

ACHA (average achievement) *ACHI (individual achievement) -> Individual motivation (to see whether this effect varies according to the individual's achievement..?)

2. Or should I do this variable manually as an interaction at the individual level (ACHA *ACH), where these two variables are defined as variable list?
 anonymous posted on Saturday, December 14, 2019 - 6:02 am
I just noticed that I wrote the model incorrectly in a hurry.

Define:
ACHA=cluster_mean(ACH);
center ACH (grandmean);

ANALYSIS:
TYPE = twolevel random;
estimator=mlr;

MODEL:
%WITHIN%
inw by x1 (1)
x2 (2)
x3 (3);

s| inw on ACH;

%BETWEEN%
inb by x1 (1)
x2 (2)
x3 (3);

s on ACHA;
inb on ACHA;
---

1. Do you know if this effect ACHA on s tell whether there is interaction
ACHA *ACHI - > Individual motivation ?
whether this effect varies according to the individual characteristics (i.e.,achievement..)?

2. If not, do you know how I can determine this cross-level interaction in MPLUS?

Thank you!
 Bengt O. Muthen posted on Monday, December 16, 2019 - 4:24 pm
Cross-level interaction is discussed in our Topic 7 short course on our website. Note also our web page

http://www.statmodel.com/Mediation.shtml

We can assist you further if you send your output to Support along with your license number.
 anonymous posted on Tuesday, December 17, 2019 - 6:52 am
Thanks a lot. I look at these.

G1. If I specify cross-level interaction to determine whether the effects of the class-level predictor (SESr) on the individual-level outcomes (jow) differ by the individual-level predictors (SES).

SESr*SES-> jow

Class-level predictor is cluster-mean of the individual-level predictor.

Should I grand-mean or group-mean individual-level predictor SES if I want to investigate G1.


I noticed that individual-level predictor were grand-mean centered in this short course.
 Bengt O. Muthen posted on Wednesday, December 18, 2019 - 1:33 pm
I would group-mean center them so that the predictor refers to within-level relationships.
 anonymous posted on Thursday, December 19, 2019 - 2:45 pm
Thank you so much.
 Walimuni Mangala Duminda De Silva posted on Thursday, January 30, 2020 - 11:53 pm
Dear Dr Muthen,
I am new to Mplus, and I am trying to test a 2-1-1 ML moderated mediation model with two moderators, both moderating the M-Y path (b). My IV is a level 2 variable. I have drafted the below syntax (X, M, Y, 2 Mod V,Q, simple slopes-ss). Can you please guide me whether this is correct.


DEFINE: CENTER M V Q (grandmean);
MV= M*V;
MQ= M*Q;
VARIABLE:
Names are ID X Y M V Q;
USEVARIABLES are ID X Y M V Q MV MQ;
Between is X;
Cluster is ID;
ANALYSIS: TYPE= Twolevel Random;

MODEL:
%WITHIN%
V MV Q MQ Y;
Y ON M (b2);
Y ON V (b3);
Y ON MV (b4);
Y ON V (b5);
Y ON MV (b6);
%BETWEEN%
X M Y;
M ON X (b1);
Y ON M (b2);
Y ON X;

MODEL CONSTRAINT:
NEW(b4b1 b6b1 b1b2 ssv1 ssv2 ssv3 ssq1 ssq2 ssq3);
b4b1=b4*b1;
b6b1=b6*b1;
b1b2=b1*b2;
ssv1= b1*b2+b4*b1*(-1);
ssv2= b1*b2+b4*b1*(0);
ssv3= b1*b2+b4*b1*(+1);
ssq1= b1*b2+b6*b1*(-1);
ssq2= b1*b2+b6*b1*(0);
ssq3= b1*b2+b6*b1*(+1);

OUTPUT: SAMPSTAT STDYX CINTERVAL;
 Bengt O. Muthen posted on Friday, January 31, 2020 - 10:56 am
You give a label twice for Y ON V and for Y ON MV.
 Walimuni Mangala Duminda De Silva posted on Friday, January 31, 2020 - 4:14 pm
Thank you for the prompt response.
Sorry, it should be Q the 2nd moderator. Is it OK now?

DEFINE: CENTER M V Q (grandmean);
MV= M*V;
MQ= M*Q;
VARIABLE:
Names are ID X Y M V Q;
USEVARIABLES are ID X Y M V Q MV MQ;
Between is X;
Cluster is ID;
ANALYSIS: TYPE= Twolevel Random;

MODEL:
%WITHIN%
V MV Q MQ Y;
Y ON M (b2);
Y ON V (b3);
Y ON MV (b4);
Y ON Q (b5);
Y ON MQ (b6);
%BETWEEN%
X M Y;
M ON X (b1);
Y ON M (b2);
Y ON X;

MODEL CONSTRAINT:
NEW(b4b1 b6b1 b1b2 ssv1 ssv2 ssv3 ssq1 ssq2 ssq3);
b4b1=b4*b1;
b6b1=b6*b1;
b1b2=b1*b2;
ssv1= b1*b2+b4*b1*(-1);
ssv2= b1*b2+b4*b1*(0);
ssv3= b1*b2+b4*b1*(+1);
ssq1= b1*b2+b6*b1*(-1);
ssq2= b1*b2+b6*b1*(0);
ssq3= b1*b2+b6*b1*(+1);

OUTPUT: SAMPSTAT STDYX CINTERVAL;
 Bengt O. Muthen posted on Sunday, February 02, 2020 - 4:56 pm
Which variables should be put on the Within list?
 Walimuni Mangala Duminda De Silva posted on Sunday, February 02, 2020 - 7:33 pm
The mediator (M), two moderators (V,Q) and the DV (Y) are in the within list.The IV (X) is a level 2 continuous variable, hence it is on the between level.Both V and Q are moderating the path b (MV and MQ),at level 1.Y ON X is the direct path.

This is based on my theorization. Is the syntax OK based on above?

Thanks
 Bengt O. Muthen posted on Monday, February 03, 2020 - 5:19 pm
But your input mentions Y on Between so that is contradictory to having Y on the Within list.

We need to see your full output - send your output to Support along with your license number.
 anonymous posted on Wednesday, February 26, 2020 - 8:07 pm
Hello,

I am estimating a multilevel moderated mediation model in Mplus v.8.4, in which a L2 variable moderates both the L1 and L2 x-m associations. Y is dichotomous; all other variables are continuous. Is the following syntax correct?

USEVAR = ID x z m y;
CLUSTER = ID;
BETWEEN = z;
CATEGORICAL = y;

ANALYSIS:
TYPE IS TWOLEVEL RANDOM;
ESTIMATOR IS BAYES; PROC=4; VARIANCE=0.01;

MODEL:

%WITHIN%
WPx BY x@1; WPx*.7; x@.01;
WPxz | WPx XWITH BPz;
s | m ON WPx;
m ON WPxz;
y ON m WPx;

%BETWEEN%
BPx BY x@1; BPx*.7; x@.01;
BPz BY z@1; BPz*.7; z@.01;
BPxz | BPx XWITH BPz;
m ON BPx BPz BPxz;
y ON m BPx;
[z@0 x@0];
 Roy Konings posted on Monday, March 16, 2020 - 8:46 am
Dear dr. Muhten,

I have a multilevel model in which I have a predictor on the within level (teacher-student relation) and on the between level (teacher's multicultural attitude), predicting a within-level variable (pupil's attitude towards refugees). Theoretically, I also have the hypothesis that the influence of teacher's multicultural attitude on pupil's attitudes towards refugees is stronger if the relationship with their teacher is better (cross-level interaction). Can I test this hypothesis by creating a random slope for the effect of relationship quality on attitude towards refugees, and use teacher's multicultural attitude as a predictor for that slope? If I understand it correctly, I am then actually testing whether relationship quality has a bigger impact if a teacher has a stronger multicultural attitude. Suppose I find this, can I then also conclude that a teacher's multicultural attitude has a bigger impact on pupil's attitudes towards refugees when they perceive a better relationship with their teacher? In other words, are the predictor and moderator also statistically interchangeable in multilevel analysis? If not, do you have a suggestion as to how to test the interaction instead? Many thanks in advance!
 Bengt O. Muthen posted on Monday, March 16, 2020 - 11:02 am
A cross-level interaction represented by a random slope is usually done as

Within:
S | Y ON X;
Between:
S ON Z;

so that you have a cross-level interaction between X and Z, that is, the Y ON X slope varies across Between units. It sounds like you have a somewhat different interest. Abbreviating your variables, it sounds like you have:

Within:
PATR ON TSR;
Betweeen:
PATR ON TMA; ! PATR is a random intercept

with the complication that you want the Between-level regression to be moderated by the TSR variable (that is, its Between-level part). If this is what you meant, I think it can be done.

The symmetric interpretation that you refer to is correct.
 Y.A. posted on Sunday, August 09, 2020 - 2:33 am
Dear Prof. Muthen,

I am doing a multilevel moderated mediation model, however, I have two level-2 moderators (MOD1 and MOD2), MOD1 moderating level1 X -> MED path, whereas MOD2 further affcting the moderation effect of MOD1, that is, a second-order interaction. I tried to specify model as below, but I am not sure if it is correct, could you give me some advice please? Thank you very much.

between=MOD1 MOD2;
cluster=subid2;

define:
center
MOD1 MOD2 (grandmean);

analysis:
type=twolevel random; bootstrap=10000;

model:
%within%
s|MED on X;
Y on MED(b)
X;

%between%
MOD1(var1);MOD2(var2);
[s](a0);s on MOD1(a1); s on MOD2(a2);
MED on MOD1 MOD2;

what is the way to specify the second-order interaction effects? Thank you very much.
 Bengt O. Muthen posted on Monday, August 10, 2020 - 3:10 pm
Sounds like you want to create a between-level interaction variable Mode12=Mode1*Mod2 and have

s on Mod1 Mod2 Mod12;
 Y.A. posted on Friday, September 11, 2020 - 10:28 pm
I would like to calculate simple slope based on a second-order cross-level interaction. Could you tell me how to specify the code using Mplus? I have a level-1 x, med, y, and level-2 mod1 and mod2. So far I have the model:

within=x y;
between=mod1 mod2 int;
cluster=subid2;

define:
center
x y(groupmean);
int=mod1*mod2;! mod1 and mod2 has already been centered

analysis: type=twolevel random;
estimator=bayes;

model:
%within%
s|med on x;
y on med(b)
x;

%between%
mod1(var1); mod2(var2);
[s](a0);s on mod1(a1) mod2(a2) int(a3);
med on mod1 mod2 ;
med with s;

Can I get the simple slope of med on x when the mod1 is at 1sd above the mean and the mod2 is at 1sd below the mean by:

model constraints:
new (simp);
simp=a0+a3*sqrt(var1)-a3*sqrt(var2);
 Bengt O. Muthen posted on Sunday, September 13, 2020 - 5:30 pm
I think you want to express 2 simple slopes, one for each moderator:

a1+a3*Mod2

a2+a3*Mod1

That means that each is evaluated at the mean of the other moderator (which is 0 since you centered).
 Y.A. posted on Tuesday, September 15, 2020 - 6:37 pm
Dear Prof. Muthen,

Thank you very much for the quick response. Actually what I am trying to do is a model that the moderation effect of MOD1 is further moderated by MOD2, not simply two seperated moderation effect. Would that be possible?
 Bengt O. Muthen posted on Wednesday, September 16, 2020 - 3:21 pm
The you have to use Define to created the product of mod1 and mod2 and go from there.
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: