Message/Author 

Kai Rödiger posted on Monday, September 30, 2013  2:29 am



Dear Linda and Bengt, I'm quite new to MPlus and Multilevel Modelling but I figured out most of the basic stuff quite well. Now I have serious problems with a CrossLevel Interaction and need your help to know if it is possible at all to have a model like this. So in short: I have LVL 2 measurements at the employee lvl (customer attitude) and LVL 1 measures at the customer LVL (perception of behavior). I want this path to be moderated by the age difference between employee and customer modelled by (AE  AC). Each employee has up to 3 matched customers so there are up to 3 different values for Delta Age. Delta Age (I think this has to be a WithinVariable)    v Employee Behavior (L2) > Customer Perception (L1) I tried various ways to define the slopes in the within and between part of the model but none of them worked out. Could you give me a hint if at all (and if yes how) such a relationship can be modelled? Best regards and thank you very very much in advance, Kai 


Example 9.2 shows how to model a crosslevel interaction. 

Kai Rödiger posted on Tuesday, October 01, 2013  2:22 am



Thank you for your quick answer but I think my problem is a different one. Example 9.2 shows a a LVL 2 Variable moderating a LVL 1 > LVL 1 path. What I want to model is a LVL 2 Variable moderating a LVL 2 > LVL 1 path. Is this possible at all? Thank you very much in advance for your answer again and I hope you can help me. Best regards, Kai 


I think what you want is USEVARIABLES = y x z w zw; WITHIN = x; BETWEEN = z w; DEFINE: zw = z*w; MODEL: %WITHIN% y ON x; %BETWEEN% y ON z w zw; Note that the y on between is the between part of y. Latent variable decomposition is discussed in Example 9.1 and 9.2. 

Kai Rödiger posted on Wednesday, October 02, 2013  4:44 am



Thank you again for your quick response. What we want is the following: USEVARIABLES = y1 y2 x z; WITHIN = z; BETWEEN = x; MODEL: %WITHIN% y2 ON y1; %BETWEEN% y1 ON x; Sy1 ON x; !Path to be moderated is a LVL2 on LVL1 Path S ON z; !Moderator z is a withinvariable. No matter in which part of the model this path is defined, MPlus produces error messages. Is modelling the interaction via multiplication a common option in multilevel analysis? I thought it is necessary to use the random slope method. Thanks again and best regards, Kai 


In multilevel modeling, you can't have a random slope on the highest level. 

Kai Rödiger posted on Monday, November 25, 2013  3:02 am



Dear Linda, thank you very much for your response. Do you have any suggestion how to solve this problem? Which method / approach might be best if crosslevel interactions won't work here. Is a multilevel multigroup analysis a valid approach for this problem? Thank you very much for your response, Kai 


This seems a reasonable approach. 

Yanxia WANG posted on Thursday, March 19, 2015  7:44 pm



Hello, I am new to Mplus, and recently met a similar problem which the level 2 moderator moderates the relationship between independent variable from level 2 and dependent variable from level 1. I did what Linda suggested, however, Mplus reported error with undefined zw (the interaction item). I really could not figure it out. Would you please help me to handle with this problem? Thanks a lot. 


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

Bep Uink posted on Thursday, December 03, 2015  6:10 pm



Hello, I am running a 2 level model in the uni variate format, with experience sampling data. I am trying to predict an outcome at time 1, controlling for a covariate a t1. However, I do not want betweenday lags (i.e. I do not want participants ratings in the morning to be predicted by their last rating on the previous day). However, I am not sure the syntax for this? I have thought of excluding observations the occur in the first time point of the following day, but these are are also used as t1 covariates for the following time point. Any help would be very appreciated. Thank you. 


You can consider three level modeling where the middle level = day. Alternatively and probably the easiest is to have 0 for that covariate in the data for the first observation in the day. 

Bep Uink posted on Sunday, December 06, 2015  10:09 pm



Thank you, Tihomir. I am not clear on what covariate. To be more clear, I am trying to regress mood at time 1 onto event at time 1, controlling for mood at t1. Because I do not want events from the previous nights' time point predicting the next mornings' mood, should I replace data for night time events with 0? 


I would recommend reading these three papers Ellen L. Hamaker, Conor V. Dolan, and Peter C. M. Molenaar (2002) On the Nature of SEM Estimates of ARMA Parameters, Structural Equation Modeling, 9(3), 347–368 Joran Jongerling, JeanPhilippe Laurenceau, Ellen L. Hamaker (2015) A Multilevel AR(1) Model: Allowing for InterIndividual Differences in TraitScores, Inertia, and Innovation Variance, Multivariate Behavioral Research, 50:3, 334349 Zhiyong Zhang, Ellen L. Hamaker, John R. Nesselroade (2008) Comparisons of Four Methods for Estimating a Dynamic Factor Model Structural Equation Modeling, 15:377–402, 


hello, I am running a 2 level model with a crosslevel interation. The question is I want get the coefficient of %within% level: s  Y on X. I am wondering if the code of %between% level:[s]; could get me the coefficient? If the intercept of s in the output is the coefficient? Here is my full code if you need: within=x; between=M; culster=group; analysis:type=twolevel random model: %within% sY on X; %between% [s]; s Y on M; 


You can get one s value for each cluster if you request factor scores. [s] gives the intercept of s. 


Thanks a lot for your reply! Could I just define a crosslevel interaction variable:XM=X*M, then code: Y on XM? If so, which level should I put the code, %within% or %between%? Many thanks! 


An interaction variable is a simpler, less general approach. You put it on Within. 


I'm trying to run a model with a crosslevel interaction that I would normally run in a growth curve framework, but I need to use weighting within each wave and it's my understanding that I have to run the analysis in long form as a result. Similar to a parallel analysis, I'd like to examine both the change in one variable and its intercept as predictors of change in another variable. I followed the example posted on here and in the user's manual for generating the random slope and examining it as a betweenlevel outcome, but when I try to examine the random intercept as a predictor on the betweenlevel, I get an error that says that I can't have a yvariable specified on the within level and also use it as an xvariable on the between level. I also have a betweenlevel variable that I'd like to use as a moderator of the random intercept. So, I'm wondering if there is a way to do this in Mplus. If not, is there any reason I couldn't examine moderation by generating the interaction terms with the define command and placing them as within level predictors similar to the code below? I realize it doesn't answer the exact same question statistically, but I think seems to test moderation in a way that is theoretically fairly similar. Thanks in advance! %within% a on time b INTtimeB INTtimeC INTtimeD BC BD timeBC timeBD ; %between% a on Gender Age C D ; 


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


hello, I am running a 2 level model with a crosslevel interation. The question is if the intercept of s in %between% level is the the effect of Y on X in %within% level? If not, can I get an exact coefficient of the effect of Y on X in %within% level? Here is my full code if you need: within=x; between=M; cluster=group; analysis:type=twolevel random model: %within% sY on X; %between% s Y on M; 


The intercept of s is the mean of the effect of X on Y when M=0. If you grandmean center M, it is the same as the s mean. 

Mengting Li posted on Wednesday, August 01, 2018  12:17 am



Thank you so much for your reply! So in other words, if I grandmean center M, the intercept of s could represent the coefficient of the effect of X on Y? Is that true? Thank you again for your reply. 


Yes, but you shouldn't say "coefficient of the effect of X on Y" because there isn't just one effect  your random slope model says that the coefficient varies across clusters. So you should say "the mean of the effect of X on Y". The word "mean" is important here. 

Mengting Li posted on Wednesday, September 12, 2018  12:24 am



When running a twolevel regression analysis, the Mplus guide suggests to grandmean the fist level independent variable X. However, as suggested by HLM manual, the first level variable should be group mean and the second level variable should be grandmean. So I am wondering which way of centering is better in multilevel analysis? 


We now recommend groupmean centering for within and using a cluster mean for between. Both can be done in Define. 


The above answer refers to using an observed groupmean centered X which is declared as Within and an observed cluster mean X variable which is declared as Between. A better alternative is to not put X on the Within list and let Mplus decompose X into a latent within and between part as described in ex9.1, part 2. This gives latent variable centering with advantages 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 grouplevel effects in contextual studies. Psychological Methods, 13, 203229. 

Mengting Li posted on Thursday, September 13, 2018  12:12 am



Thank you so much for your reply! Since I also want to examine the effect of interation of within X and between X, so I guess, the example in ex9.1, part 2 is not suitable for me? I also have another question: Were the CFI, RMSEA not reported in the multilevel analysis with "twolevel random" command? If so, what should I report as the model fit index? 


I don't know what you mean by "interaction of within X and between X". Perhaps you mean %Within% s y on xw; %Between% y s on xb; This implies an interaction between xw and xb in their influence on y. 

Back to top 