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.
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.
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?
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.
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
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.
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.
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?
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.
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.
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.
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 firstname.lastname@example.org 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?
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;
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?
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?
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.
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.
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.
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
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?
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
I ON A_SocCap; LifeSat ON A_SocCap;
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.
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;
*** 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.
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?
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.
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?
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.
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?
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;
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)
 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.
 Related to  is there any way of getting predicted values from Mplus?
 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"?
 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?
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
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:
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:
S ON empsec
Mean - 1 SD
Mean + 1 SD
These can be plotted (see here), which seems to make sense.
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.
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
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.
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;
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.
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.
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
I'm trying to interpret a coefficient in a two-level path analysis model.
The model is:
s | satlife ON empsec;
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:
UEMPAV 0.000 GROW 0.037 EMPSEC -0.810
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?
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;
These look correction. In Model B, be certain the variance of y is estimated as the default. Otherwise add it on within.
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
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;
s1 ON pbur_1(gam1); [s1] (gam0); s1 with pder_1;
MODEL CONSTRAINT: New (ylow yhigh); ylow = (gam0+gam1*(-.032)); yhigh = (gam0+gam1*.032);
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;
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
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)
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
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.
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
%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.
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.
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)?
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.
Responses are given on Mplus Discussion not via email.
Sara Guediri posted on Monday, September 09, 2013 - 10:35 am
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?
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?
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!
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:
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?
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"?
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
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:
How can I test the significance of the interaction? (beyond just looking at the p-value or credible intervals)
The response I got was:
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).
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?
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.
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.
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?
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;
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;
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.
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;
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).
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!
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.
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
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; ...
VARIABLE: ... Within = IV1-IV4; Between =; MODEL: %Within% DV BY DV1-DV4; IV BY IV1-IV4; b1 | IV ON DV;
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!
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;
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
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?
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.
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?
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;
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.
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.
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);
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.
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.
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!
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;
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?
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.
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?
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?
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
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?
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;)
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?
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;
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?
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;
%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)?
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?
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).
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;
%within% pv1civ on age gender hisei imm; s | pv1civ on cvln sopd spart ;
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.
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!
1) You can, although z scores are standardized values while grandmean centering simply subtracts the mean, not dividing by the SD.
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
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;
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?
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?
anonymous posted on Friday, December 13, 2019 - 2:05 pm
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
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?
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;
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?
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
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;
%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];
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!
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.
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.
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:
I think you want to express 2 simple slopes, one for each moderator:
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?