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?
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.
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.
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?
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)
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?
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?
Hi, 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.
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:
Model: %within% 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: NEW(ind_eff); IND_EFF = b3_between*b2_between;
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?
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?
Hello, I would like to test a 2-1-1 mediation hypothesis within a (larger) MSEM. I use the syntax provided by Preacher, Zyphur, & Zhang (2010) and started with a small model consisting only of continuous variables. For this model the MSEM and the UCM produce comparable results. Now I would like to transfer this to a dichotomous mediator and I ask myself how to build analogous models: In the UCM; if I composed the L2-variable of the dichotomous mediator as the mean of this variable, will this be substantially the same as the latent L2-variable in the MSEM? If not: How do I compose a manifest counterpart?
Thank you for the quick reply. Now I have a follow-up question concerning L1. In the UCM, the covariate x and the mediator m have to be group mean centered on L1. However, in Mplus this is not possible for categorical variables. (1) How do I disentangle within- and between effects of categorical variables in an UCM in Mplus? (2) How should I imagine the latent version of my dichotomous L1 variable in a MSEM: Is it substantially comparable to a group mean centered manifest version of the variable? If yes, how can I construct analogous models (UCM - MSEM)?
I think you are getting into a methods research area. If you are going to be serious about a binary mediator you have to study up on the issues. For instance, there is a choice of either taking the WLSMV approach of focusing the modeling on the continuous latent response variable underlying the binary observed variable, or taking the counterfactual causal effect approach (but this is not easy with 2-level models). I describe the issues of a binary mediator in my 2011 and 2014 mediation papers (see our website). With the WLSMV approach the mediator is then continuous so binary-specific issues may no longer be present.
Thank you for the advice. Even if the binary mediator were not focal, my dependent variable is also binary. Furthermore, I have missings in my data. Please correct me, but the usual recommendation is to prefer ML over WLSMV in this case. Concerning that I am no statistician I won’t be able to apply the counterfactual causal effect approach on a 2-level-model. So I will try to keep it simple and divide my model in several regressions, following the classical mediation analysis. In doing so I would like to use the Mplus approach which decomposes covariates in two latent parts.
Now I hope that you can give me an advice or a reference as regards this difficulty: I would like to investigate, whether a compositional effect is mediated and I assume that the Mplus approach is analogous to group mean centering of manifest variables. So bc is not calculated (but should be the difference of bb and bw).
(1) How do I calculate the indirect effect in this case and why? I see two options: (a) Do I first have to calculate the compositional effects for X-M (a) and M-Y (b) and then their product? (b) Or do I first have to calculate the product of (a) and (b) on both levels and then the difference of the products? What are the differences in meaning of the two options? (2) How do I calculate the standard errors for the “right” option?
I don't think I know the answers here; seems like it requires methods research.
I assume that you have a model like
Y ON M X; M ON X;
extended to a 2-level setting with a W predictor of random effects on level 2. But your M and Y are binary.
With missing data on M or Y I would recommend ML over WLSMV.
Even if Y and M were continuous, I am not sure what you mean. By decomposing covariates I don't know if you mean decomposing X or M or both. You say you are interested in whether a compositional (contextual) effect is mediated - but I don't know if you are referring to a level-2 relationship. Perhaps a path diagram of your intentions would be helpful. On top of this your M and Y are binary and latent variable decompositions are tricky here.
I am not sure, whether we think of the same model. Please, let me describe my context of application instead of a path model: We know that after primary school the individual SES explains the choice of a school track but beyond that, the mean SES of the class has additional explanatory value (compositional/contextual effect). Let’s consider a metric mediator: I assume that a higher SES results in higher aspirations which in turn promote the choice of a more demanding school track (Other assumptions contain the binary recommendation for a certain track by the teacher as a mediating variable). The questions are, whether the mediation partially/fully breaks up the direct compositional effect of SES on choice and how large the indirect effect is.
Now I would like to analyze my data by classical mediation analysis, i.e. using several regressions instead of a full path model. I thought of following the second part of ex. 9.1 in the users’s guide. The “implicit, latent group mean centering” led me to the questions in my last posting.
Would you still say that my aim requires further methods research or can you think of some suggestions/solutions as regards my questions?
If all variables were continuous, I specified the following path model:
ANALYSIS: TYPE = TWOLEVEL;
MODEL: %WITHIN% track_choice ON SES (c1); track_choice ON Aspiration (b1); Aspiration ON SES (a1); SES track_choice Aspiration; !model missingness
%BETWEEN% track_choice ON SES (c2); track_choice ON Aspiration (b2); Aspiration ON SES (a2); SES track_choice Aspiration; !model missingness
By using MODEL CONSTRAINT I could calculate the direct contextual effect of SES as c2-c1 and the indirect effects as a1*b1 for Level 1 and a2*b2 for Level 2. Now, I am interested in the indirect contextual effect. I see two options:
MODEL CONSTRAINT: !see Q1a in posting above NEW(indirect context_a context_b); context_a = a2-a1; context_b = b2-b1; indirect = context_a*context_b;
My questions: 1) Which option is the right one for my purpose? Do you know any reference? 2) In case of separate regressions I will have to calculate SE and p manually. How do I calculate them for the respective option?
I find page 140 of Raudenbush-Bryk's Second edition helpful where Table 5.11 shows the two alternatives. If you are interested in contextual effects, the right-most alternative gives beta_c directly. That approach would therefore seem to me as the one most useful to expand from regression to the mediation modeling you are interested in. That is, you would focus on the product of slopes on Between. I don't know about references on this specifically. You can still do latent variable decomposition, although I don't see that as essential.
I thought your major question was about switching from continuous to binary variables. In any case that's about all I have to say about this.
I know the mentioned table - and your suggestion (product of slopes after grand-mean-centering) is, what I would have intuitively chosen. Unfortunately, I am not able to give good reasons and I had hoped that you could think of reasons/references to justify the decision.
Nevertheless, thank you for all your efforts and advices. Katrin
Look at the right column of Table 5.11 in the Raudenbush-Bryk book. Not doing group-mean centering gives you the contextual effects on the between levels. The RB book may also discuss this in the 3-level case. So, yes, for simplicity, do manifest aggregation of X and grandmean centering.
I am trying to estimate a contextual effects in a growth model. I have measured reading achievement four times (end of Grade 1, Grade 2, Grade 3 and middle of Grade 4). The following growth model fits the date well.
On the individual level, intercept and slop are influenced by reading abilities measured at the beginning of Grade 1 (x).
However, I am interested, whether the mean reading abilities of the classes (xm) have an influence (additional to the influence of x) on individual growth in reading.
First, I thought the example on p. 270 in the Mplus User Guide v6 might relates exactly to this question. However, if I understand it correctly the example considers growth on within and between level without cross-level interaction.
Dear Drs. Muthen, I want to simulate ordinal multilevel data that has DIF. I just know I should use 2 parameter logistic IRT model. Please tell information about this model and steps of my simulation. I have a little information about this problem and I do not know where I can find about it?
Note that ex 9.1b uses a latent variable decomposition of x. As it says on page 263 of the UG, this means that Mplus uses a "latent group-mean centering of the latent within-level covariate". Hence, the betac expression.
Dirk Pelt posted on Thursday, October 01, 2015 - 4:37 am
Thanks for your answer. However, when I compare results from the two different methods of example 9.1., it appears that this betac expression is not needed.
With my data, using the first method with grandmeancentering, the between effect (Mx) on y is .16 (contextual effect), the within effect is .35. Using the second method produces identical results.
Hence, if I had used the betac expression in the 2nd method (latent decompositon of X), the conclusion would have been that the contextual effect would be .16 - .35 = -.18.
As a check, I compared the results using groupmean centering: the latent between effect is then .51 and the within effect is .35. The contextual effect being .51 - .35 = .16. Again, this speaks against using the betac calculation when using grand mean centering.
Why should adding a latent between component of X change calculations of the contextual effect? Assuming perfect reliability of Mx (as is almost the case in my data), shouldn't the results be the same? I hope you can clear my confusion.
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
Sara Geven posted on Friday, February 05, 2016 - 7:08 am
I have data on children in different academic tracks. As part of the study, I would like to test whether equally able peers have a lower academic self-view in higher ability tracks.
On the within level I measure individual ability level by test scores. The academic track of students is purely a classroom variable (does not differ between students in a class).
Can I apply the contextual effect calculation here as well? More specifically, is it correct to substract the between-level track effect on academic self-concept from the within level effect of academic ability on self-concept.
See the text of UG ex 9.1 and also Table 5.11 in the Raudenbush-Bryk multilevel book.
Sara Geven posted on Monday, February 08, 2016 - 3:05 am
Dear Prof Muthen,
I looked at the examples. Yet, in example 9.1 the x at the between level and the x at the within level are the same variables with the same metric. I am wondering whether it is appropriate to subtract a within level effect from a between-level effect when the x's at the different levels are different variables (i.e. ability test score versus ability track). I do control for the ability test score at the between level of course.
Is there a way of using the latent contextual effect (Raudenbush & Bryk, 2002) as shown in Ex 9.1 from Model constraint in further analysis, such as an interaction effect or is this only possible with a manifest contextual variable?
In other words, I don't want to test whether a between group effect interacts with another variable, but whether the contextual effect interacts with another variable.
betac is not equal to xbj - xwij but is a coefficient, that is, a value, not a variable. It needs to be a variable to interact with other variables. It could be random (and therefore a variable) if you have yet another Between level.
Dear Dr. Muthén, I just read the latent centering paper in the SEM Journal. I'm espacially interested in the probit example. You use r(Ybj,Xbj) to evaluate the quality of estimation. But r is pure Level 2 estimate, isn't it (because it's solely based on L2-paramters)? So I'm wondering how to define/estimate the contextual effect. Why don't you use (b2 - b1), just like in the linear case, and use this for the calculation of r? Thanks Christoph
We preferred r(Ybj,Xbj) as it is scale and model parameters independent, which gives sort of a universal indicator of quality. For example you can compare Table 8 and 9 even though they are very different. I think the earlier version of the paper might have had also the uncentered method there which makes the comparison a bit trickier across the methods (but not if you use the correlation). r(Ybj,Xbj) is not pure Level 2 estimate in the context of centering methods comparison as the levels get intertwined. Anyway, the call for which comparison to use was purely subjective. You can easily evaluate b2 - b1 using our scripts http://www.statmodel.com/download/LatentCentering.zip
Thanks, I get it. Regarding the Level 2 estimate. What I meant is that r corresponds to b_between of the linear case for latent mean or Group mean centering and of course covers Level 1 and 2 effects. Is this correct?
One further Question: I'm interested in a model with a binary predictor and a binary Outcome. In this case, what would be a suitable effect size estimate for the contextual effect? Is it possible to use r as an ES (and use b2-b1 instead of b2)? Or could effects size estimates as used in several Marsh, Lüdtke papers also be applied to probit models with residual variance = 1 on L1? best Christoph
Formula (64) shows that r depends only on between level parameters. When observed centering is used, however, the biases show up in multiple places b1, b2, sigmas, etc. see Table 3 and 4, not just in b2-b1. What I meant that the levels are intertwined is that an error in Xb results in an error in Xw since Xw = X-Xb.
I think effects size estimates could be used as in Marsh and Lüdtke. For the contextual effect size (between level relationship) you don't fix anything to 1 so the logic and the interpretations should be very similar I think.
Thanks for the clarification. Regarding ES: What I meant is, that if ES = 2*b_b*SD(pred_b)/SD(outcomeL1), than SD(outcomeL1) = square root(b_w*b_w*var_w + e) and e = 1 in the probit model. A'm I right?
These formulas were developed for the continuous variables. They can be used for categorical as well with the Y* interpretation but there probably is a better way to evaluate the standardized BFLP effect for categorical variables. You might want to contact Marsh and Lüdtke to see their take on this.
Thanks for the valueable hints. Regarding the formula. There are several versions of the ES. Tymms (2004, p. 62) proposes the residual L1 SD of the outcome (after controls). Marsh et al. (2009, p. ) extend ES by "operationalizing effect size in relation to the total variance of the L1-ASC rather than its residual" (ES2). Further, they also use the total SD (as you proposed; ES3). In subsequent papers of Marsh et al. only ES2 (SD at L1) was used (e.g. Morin et al., 2014). In the Wang (2015) paper ES3 is used. Do you have any references, what would be the "best" ES for the continuous case?
Dear Mplus-Team, a follow up question. I'm doing a simulation for contextual effects with binary X and Y. I'm wondering how to specify the threshold for Y which is conditional on X. This seems easy when X is continous, but how is this done with a threshold on a probit scale (similar to your binary predictor model in the latent centering paper).
I use the following model on L2.
P(y=1|X) = F(a + b1*X) P(x=1) = F(ax) ax = 1.64 (--> x = 1 approx. 5%) b1 = 0.59 How to solve this for Y = 1 approx. 5%? Christoph
When modelling contextual effects in two-level regression models where the contextual effect is the group average of an individual-level indicator, such as SES, group-mean centering and grand-mean centering provide equivalent estimates, that is, in the group-mean centered model, context = between-within, whereas the grand-mean centered model provides a direct estimate of the contextual effect. But I have found that when applying Marsh et al. (2009) latent-manifest method to a 3-indicator measure of SES (from the PISA dataset) the grandmean centered model provides a larger standardized coefficient for the contextual effect than the coefficient derived from the group-mean model. I am wondering why this is the case?
I am not familiar with the "latent-manifest" method. When Mplus does a latent variable decomposition of a predictor, latent group-mean centering is done. A good discussion is given in the paper on our website:
Asparouhov, T. & Muthén, B. (2018). Latent variable centering of predictors and mediators in multilevel and time-series models. Structural Equation Modeling: A Multidisciplinary Journal, DOI: 10.1080/10705511.2018.1511375 (Download scripts).
Tsz Tan Lau posted on Tuesday, October 15, 2019 - 1:07 pm
Hi Drs Muthén,
I am doing a doubly latent model in Marsh (2009). The variable pv are plausible values processed by TYPE = IMPUTATION, all variables are standardized:
%within% aw by a1 (1); ... aw by a4 (4); pv on aw (b_w); pv (theta_w); aw (psi_w);
%between b1% ab1 by a1 (1); ... ab1 by a4 (4); pv on ab1 (b_b1); pv (theta_b1); ab1 (psi_b1); pv on conf; ab1 on conf;
%between b2% ab2 by a1 (1); ... ab2 by a4 (4); pv on ab2 (b_b2); pv (theta_b2); ab2 (psi_b2);
1 Is it right to calculate the lv3 unstandardized contextual effect as b_b2 – b_b1 or b_b2 – b_w? 2 For path pv on conf and ab1 on conf, do I need to calculate standardized coefficients like the contextual effects?