Contextual effect for twolevel SEM PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
 Student 09 posted on Saturday, December 27, 2008 - 3:04 am

I wonder how to correctly compute a contextual effect when using a twolevel SEM with latent factors.

Following Raudenbush and Bryk (2002, p. 141), for models with groupmean-centering the contexual effect is computed as

beta_between - beta_within.

This could straigtforward be applied to a model where one regresses e.g.
latent factor Y on latent factor X on both levels, and then computes the differences in the unstandardized beta`s. Would this be correct? If so, how could I test the significance of any difference between these two beta`s?

 Bengt O. Muthen posted on Friday, January 02, 2009 - 8:10 am
This topic is a little involved, which has delayed our answer. There has been some work done on this and we are checking if this is ready to be distributed. One key issue which the observed variable case of R&B doesn't face, is that the formula you give would only be relevant if the within and between factor loadings were equal so you are sure you are dealing with the same latent variable on both levels. That equality often does not hold.
 Student 09 posted on Monday, January 05, 2009 - 9:55 am
Dear Dr. Muthen

I would be very grateful if you would notify me once your work is published - if you are aware of any further published research reports in this field (I am not) please let me know

 Student 09 posted on Monday, February 16, 2009 - 2:20 am
Dear Dr. Muthen

according to Bryk and Raudenbush (2002, 141), a contexual effect can - besides the grandmean-centred centered approach (e.g. ex9.1a & ex9.1b)- also be computed as: b_between - b_within = b_contextual.

A potential limitation of this approach is that one gets no information whether the resulting difference is significantly different from zero.

To obtain this information apart from the grand-mean centered approach, I am curious whether it would be correct to

A) constrain the within- and between-regression weights of the variable of interest to equality and then

B) compare the fit of a constrained (b_between = b_within) to an unconstrained (b_between /= b_within) model. Then,

C) if the fit of the constrained model would not differ from the unconstrained model, I would argue that the contextual effect (b_between - b_within) is not significant.

Would this procedure be correct?

 Bengt O. Muthen posted on Monday, February 16, 2009 - 6:31 am
See page 231 of the Version 5 User's Guide for how to get this significance information using Model Constraint. See also

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.

under Papers, Multilevel SEM.
 Student 09 posted on Monday, February 16, 2009 - 7:42 am
Thanks, I'll check the Ludtke paper. In the meantime, let me ask whether it is correct that the within-slopes must be invariant (=fixed coefficients, variance between groups) for estimating contextual effects?

Thanks a lot!
 Student 09 posted on Monday, February 16, 2009 - 8:22 am
Thanks for the Ludtke et al. reference which, for the time being, clarified my earlier questions.
 Bengt O. Muthen posted on Monday, February 16, 2009 - 8:24 am
The contextual model uses fixed slopes. See the reference our UG gives: Raudenbush & Bryk 2002, p. 140.
 Student 09 posted on Tuesday, February 17, 2009 - 6:40 am

I am still not clear for which reason grandmean-centering is used in ex9.1b.

I noted that deactivating grandmean-centering yields almost identical results, the only difference being that the y-intercept with grandmean-centered X is 2.036, but without grandmean-centered X the y-intercept is 2.005.

From the UG, I understand that in line with the 'group mean example' by R&B (table 5.11, p. 140), in ex.9.1b beta_c is calculated as gamma01 - gamma10.

For this way of calculating contextual effects R&B do not use grand-mean (X..), but group-mean (X.j) centering only.

Grand-mean centering is used in the right hand example of table 5.11. But because in this second example beta_c is equal to gamma01, this procedure obviously differs from the way contextual effects are estimated in ex9.1.b. That's were my confusion comes from.

So at the risk of asking something very obvious or which could be deduced from the Luedtke et al. paper, I would be very grateful if you could give me an answer a) whether and if so,
b) for which reason grandmean-centering must be used in ex9.1b-types of analysis?

Many thanks for your answer!
 Bengt O. Muthen posted on Tuesday, February 17, 2009 - 10:55 am
Grand-mean centering is not essential for ex9.1b.
 Simon Denny posted on Thursday, August 27, 2009 - 4:27 pm
I have been looking at the paper by Ludtke et al(2008) as I am running a contextual analysis of school climate.

I have a question regarding the paper which is confusing me. On page 207 it states
"Thus, y10 is the specific effect of the group mean after controlling for interindividual differences on X." (1st para top of page)

Shouldn't this be y01 as the contextual effect?

Thanks for your help!
 Linda K. Muthen posted on Friday, August 28, 2009 - 12:51 pm
Oliver Ludtke says it is a typo. "It should be gamma_01 instead of gamma_10."
 Simon Denny posted on Saturday, August 29, 2009 - 3:38 pm
Thanks Linda, a couple of follow-up questions.

1. Why in example in 9.1 do you use Centering = grandmean (x) rather groupmean? I take it that it doesn't really matter in a random intercepts only model. But would groupmean be more appropriate as this is how Mplus decomposes the latent variable (pg 231 users guide).

2. Mplus doesn't produce standardized outputs for variables in model constraint. When I subtract gama01 from gamma10 by hand from the output I get the same as the model constraint estimates. Can I do the same for standardized gamma10 and gama01 output to get standardized contextual coefficients?
 Simon Denny posted on Saturday, August 29, 2009 - 3:48 pm
sorry, just figured out that you can't use GROUPMEAN for variables used in between analyses. But why specify grandmean (x) anyhow?
 Bengt O. Muthen posted on Saturday, August 29, 2009 - 6:31 pm
The Raudenbush-Bryk (2002) page 140 Table 5.11 shows two alternatives, group- and grand-mean centering. As you see there, the grand-mean approach gets you the contextual effect directly as the between-level slope. So here you can use the standardized coefficient directly. As an exercise you can see if you get that by standardizing the subtraction in the group-mean centered alternative.
 Simon Denny posted on Sunday, August 30, 2009 - 2:48 pm
Thanks, that works for the observed covariate group-mean contextual effect.

I guess I was meaning for the second part of example 9.1, why specify grandmean centering for the latent covariate model? As described on page 231 - the latent variable is decomposed as a latent group mean. Hence the need to transform the within and between slopes as in the MODEL CONSTRAINT command.

Is it because Grandmean centering helps the maximum liklihood estimation of the latent group mean?
 Bengt O. Muthen posted on Sunday, August 30, 2009 - 3:09 pm
I don't think that centering is important.
 davide morselli posted on Thursday, August 05, 2010 - 7:08 am
I'm testing a cross level mediation in which a L2 predictor (X) has an effect on a L1 dependent latent variable (Y) via an L1 mediator (m) (it's the type 2-1-1). The dependent variable is a 2-level latent factor specified by three indicators which factor loadings are constrainted to be equal across the 2 levels.
According to Preacher, Zyphur & Zhang (2010), to test the mediation I have to free the variance of the mediator at the to levels. Namely to remove m from the WITHIN list in the VARIABLE specification of my Mplus model.
I was wondering if this mean that I need also to control for the contextual effect of m, as suggested by Ludtke et al (2008) or I simply center it on the grandmean.
 davide morselli posted on Thursday, August 05, 2010 - 10:24 am
In addition to previous post, I'm also trying to calculate the effect size of X on Y, on the basis of Marsh et al (2009).
I am interested in the total size of the effect (direct+indirect).
Using Marsh's indications I wrote the model as following:

DV_W by R1_CNV (2) ;
DV_W by R2_CNV (1) ;
DV_W by R3_CNV (3);

DV ON MV(b_within);

MV (Psi_W);
DV_W (Theta_W);


DV_B by R1_CNV (2) ;
DV_B by R2_CNV (1) ;
DV_B by R3_CNV (3);

DV_B ON IV_B (b1_between);
DV_B ON MV (b2_between);
MV ON IV_B (b3_between);

IV_B (Psi2_B);
CNV_B (Theta_B);
MV (Psi_B);

Model constraint:
IND_EFF = b3_between*b2_between;

!effect sizes
EFFSIZE = (b1_between+IND_EFF)*2*(sqrt(Psi_B + Psi2_B))/sqrt(Psi_W*b_within**2 + Theta_W);

I was wondering if you think the equation for EFFSIZE is correct.
Resulting effect size is .367; I also tried a model without the mediating variable (MV). In that case the effect size results .328

Thank you very much!!

 Linda K. Muthen posted on Thursday, August 05, 2010 - 10:46 am
The MODEL command should be as follows with neither m nor y on the WITHIN list.

y ON m;
y ON m; ! contextual effect
m ON x;

For the second part of your question, please send the full output and your license number to
 Jennifer Yahner posted on Friday, October 01, 2010 - 6:18 am
Dear Dr. Muthen,

Thanks for all your recent help.

I am also trying to estimate a 2-1-1 mediation model.

Are you saying that we should use your more simplified command above instead of the one from Example E of Preacher et al. (2010), which I have written below?

m y;
y ON m;
x m y;
m ON x(a);
y ON m(b);
y ON x;

NEW(indb); !<--Between indirect effect

 Linda K. Muthen posted on Friday, October 01, 2010 - 6:55 am
I was translated what you wrote into the Mplus language. If you want to estimate an indirect effect also, you can use MODEL CONSTRAINT as shown above.
 yin fu posted on Monday, September 12, 2011 - 7:12 am
Dear Dr. Muthen,

I am trying to moderate a contextual effect. I am using a similar syntax code to Marsh et al. 2009. When modeling their model 4 (no random slopes) and their model 5a (random slopes), the contextual effect switches from (significantly) positive to (non-significant) negative in my model.
What could be the reasons for that? The effect stayed similar in the Marsh et al. paper.
Also I am a bit unsure about the "[s] (b_within);" command on the %between% level in Model 5a. Does it say: "the mean of the variance of the slope s on level 2 is called b_within"? Isn't that different to the defining command of (b_within) in model 4?

Thanks for your help, Martin
 Bengt O. Muthen posted on Tuesday, September 13, 2011 - 9:25 am
For your first question it is best if you contact one of the two first authors.

Regarding your second question, the Model 5 statement "[s] (b_within)" says "the mean of the random slope s is given the label b_within". The Model 4 (b_within) is the fixed slope, so the Model 5 label refers to the same thing conceptually, except that in Model 5 the slope also has a variance.
 yin fu posted on Wednesday, September 14, 2011 - 3:43 am
Dear Dr. Muthen,

Thanks for clarifying. I compared my two outputs and the reason for the contextual effect to switch signs is a strongly decreasing Between Level effect.
Is it a normal thing to happen, that the between effect decreases a lot, when a random slope is included in the model, or are chances high that there is something wrong with my data?

Thanks again, Martin
 Bengt O. Muthen posted on Wednesday, September 14, 2011 - 2:13 pm
I think that can happen. See the Raudenbush-Bryk (2002) HLM book.
Back to top
Add Your Message Here
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Options: Enable HTML code in message
Automatically activate URLs in message