Andy Cohen posted on Thursday, July 12, 2007 - 8:40 am
I am conducting a 2 level analysis in which I would like to include interactions between two main effect variables in the within portion of my analysis. I am defining the variables using the DEFINE command (e.g. IntA_B = A * B). The underlying variables for the interaction terms need to be group mean centered. I have already specified group mean centering for these variables in the VARIABLE command (as that is necessary for the use of the TWOLEVEL option in the ANALYSIS command, but am wondering if the DEFINE command will use the original or centered form of the variables.
Yes, the order of operations matters. Any transformations using DEFINE should be done first and the data saved. The centering should be done on the saved data.
C. Lechner posted on Friday, February 17, 2012 - 6:38 am
Ok, thank you very much for your answer! May I ask two additional questions:
#1: I suppose the same would apply to interactions between a latent variable and a manifest variable computed using the XWITH command? I would first compute the interaction, save it, and then center it along with the other variables in the model?
#2: Assume I have a multilevel model with two predictors and an interaction between the two on level 1. One of the two predictors that interact have a random effect, the other is treated as a fixed effect. The interaction thus has to be treated as a random effect as well. However, do BOTH predictors that are part of the interaction have to be treated as random, or will it suffice to treat one as random and the second one as fixed (as I would assume)? Technically, both works fine, because in a regression or path model, Mplus will treat these interactions as any other variables. But is it correct?
Just so that I'm clear, it seems like there is no way use the CENTER command to group mean center a set of variables and then use them in a DEFINE statement in the same procedure. For example:
variable: names = AgencyID Gender Age T employ enroll engage housegb incany totsup infsup formsup anysup anyinf anyform; cluster = AgencyID; missing are all .; usevar = Gender Age T incany formsup Intx; categorical are incany; within = T formsup Intx; between = Age Gender; center = grand mean (Age) group mean (T formsup);
Define: Intx = T*formsup;
This would compute the Intx variable before group mean centering T and formsup and this isn't what I want. Is there any way around this? The manual states that the CLUSTER_MEAN option also cannot be used with subsequent DEFINE statements. So I guess that leaves me with using the SAVEDATA command to save the group means, then running another procedure using those saved variables to compute the group mean centered values. Save that data for a final time, and run a third procedure calculating the interaction term with the saved, group mean centered values. Is that correct? Or did I add in an extra step somewhere. Thanks for all your help!
Hi, I am running a two-level model to test group differences before and after an intervention. I'm entering my own time variable to represent the number of days since baseline (see sample script below). I noticed that Mplus is automatically centering my time variable. Is there a way to not center it? I would like the baseline (T1) to = 0, as this is more meaningful. Thanks!
DATA WIDETOLONG: WIDE = DV_T1 DV_T2 DV_T3 | T1 T2 T3 ; LONG = DV | timeB ;
IDVARIABLE = person ; REPETITION = time ;
Variable: Names are ID group DV_T1 DV_T2 DV_T3 T1 T2 T3 ;
Usevariables are group DV timeB person ;
Cluster = person ; Within time timeB; Between = group ;
Fit statistics are fine except for L2 srmr (above1.0). When I add groupmean centering to x1 and x2 in a subsequent run, the L2 srmr improved substantially. What could be the reason for this? Should I center? I placed x1 and x2 at within as their ICCs were very low. Thanks..
I would feel more comfortable with other fit indices for two-level modeling. Stay with chi-square, RMSEA, and CFI.
Kirill Fayn posted on Thursday, May 30, 2013 - 12:45 am
i am trying to run my first MLM on mplus and am having difficulty centring my level one variables.
The model and the error is below:
USEVARIABLES ARE Interest Cope1 Nov1 ZOpen ZInt; WITHIN = Cope1 Nov1; BETWEEN = ZOpen ZInt; MISSING ARE all (-9999); CLUSTER = subject;
DEFINE: CENTER Cope1 Nov1(GROUPMEAN); ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL: %WITHIN% IntCop | Interest ON Cope1; !need to make these factors IntNov | Interest ON Nov1; %BETWEEN% Interest IntCop IntNov ON ZOpen ZInt OUTPUT: TECH8 SAMPSTAT;
*** ERROR in DEFINE command Error in assignment statement for CENTER
Could you please help. The syntax seems to be right so I am guessing I can't centre these variables for some reason.
What version of Mplus are you using? If it is earlier than Version 7, the CENTERING option was in the VARIABLE command. If it is Version 7 or later, please send the output and your license number to firstname.lastname@example.org.
Katerina Gk posted on Wednesday, October 09, 2013 - 4:42 am
Hi, I have 5-factor model(job sat.) and self-eff.( 3-factor model).I want to aggregate by school the observed variables of the job sat. and self-effi. in the between level. If I use CENTERING = GRANDMEAN (x) is enough to understand that I need to aggregate at between level?the observed variable are the same in two levels....
Missing are all (999); CLUSTER IS sxoleio; DEFINE: CENTER = e1..a1..(GRANDMEAN) ANALYSIS: TYPE IS TWOLEVEL ; ESTIMATOR = WLSMV; MODEL: %within% er1_w by e1@1... ; er2_w by e7@1... ;
If you want an aggregated variable on the between level, use the CLUSTER_MEAN option of the DEFINE command to create it. See Example 9.1 where using this variable versus a latent variable decomposition of the individual-level variable is discussed.
Katerina Gk posted on Wednesday, October 09, 2013 - 11:55 am
In relation to the issues of centering in multilevel models raised above, I have two questions:
1. If any transformations (e.g., interaction between observed variables) are made before centering, it means that the interaction term does not use standardized scores of the products, which violates a basic requirement for the computation of any interaction term. How can I bypass this problem? Or is it not a problem?
2. When using grandmean centering (or no centering) for my within-level predictors, the fit of the model is considerably higher than when using groupmean centering. What could be the reason? Is there a preferable centering method for within-level predictors?
1. It is standard to center, not standardize, variables before creating an interaction between them.
2. See the Raudenbush and Bryk book. This is a complex topic.
Zen Goh posted on Friday, August 01, 2014 - 7:16 am
I'm running a 1-1-1 mod-med model, and have a generic question about centering.
(1) Why do we only center the X but not the M(mediator), as we do using HLM software? In HLM software, X and M are specified as group-centered predictors, so that only the within-level relationships are apparent. In Mplus, I'm only allowed to center X but not M. (see code and error message below)
(2) how does the lack of centering the mediator in MPlus affects the results and interpretation?
Zen Goh posted on Friday, August 01, 2014 - 7:18 am
NAMES = clust Gender Age Child WLoad WFCts WFCemo LSat MgSup; USEVARIABLES ARE WLoad WFCts LSat Gender Age Child MgSup; MISSING ARE ALL (-1); WITHIN = WLoad; BETWEEN = Gender Age Child MgSup; CLUSTER= clust; Define: CENTER MgSup (GRANDMEAN); CENTER WLoad (GROUPMEAN); ANALYSIS: TYPE = TWOLEVEL RANDOM; MODEL:
*** 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: WFCTS *** ERROR in MODEL command Within-level variables cannot be used on the between level. Within-level variable used: WFCTS *** ERROR in MODEL command Within-level variables cannot be used on the between level. Within-level variable used: WFCTS *** ERROR in MODEL command Within-level variables cannot be used on the between level. Within-level variable used: WFCTS *** ERROR The following MODEL statements are ignored: * Statements in the BETWEEN level: WFCTS ON MGSUP WFCTS ON GENDER WFCTS ON AGE WFCTS WITH S1 LSAT WITH WFCTS
Variables on the BETWEEN list cannot be used in the within part of the model. They are measured on the cluster level. This is not related to centering. Read Example 9.1. It goes over all of the multilevel options. Example 9.2 shows a random slope model with a cross-level interaction.
Zen Goh posted on Friday, August 01, 2014 - 12:53 pm
I think I might not have been clear in my question.
My mediator (not moderator) variable is also a within, level-1 variable - why do we not center this as well? Would this not affect the interpretation of the results?
I am running a 1-1-1 path model (using manifest variables) with non-independence in my DV (high ICC1; performance rated by common supervisor). In reading about centering (e.g., Enders & Tofighi, 2007), it is clear I need to group-mean center my predictors to prevent between-group variance biasing my results. However, I wonder why we don't group-mean center the DV to "purge" out between-group variance in the DV and only include within-group variance?
In books and in papers I generally find that the DV is not centered, but in the case of non-independence, doesn't the DV then include a lot of "noise" and how exactly does Mplus deal with the DV then?
E.g., is defining the DV at the WITHIN level an option? Are there other options to take care of this?
Dear Muthén, I appreciate the new define functions in version 7.2, where order of commands has significance.
In a multilevel regression model where y(within) is regressed on x1(groupmeancentered (GMC)) and x2(GMC), should the interaction term for x1 and x2 (x1*x2) be computed before or after the GMC? That is, to first calculate x1*x2, and then GMC x1, x2, and x1*x2, OR calculate x1(GMC) and x2(GMC), and then calculate x1*x2 as x1(GMC)*x2(GMC).
1) y(within) on x1(GMC) x2(GMC) x1*x2(GMC) OR 2) y(within) on x1(GMC) x2(GMC) x1(GMC)*x2(GMC)
(say that, for example, y is lung cancer, x1 is smoking, and x2 is working with asbestos).
Hope you can help me with this conundrum, Eivind Ystrom
You can get wider input on general centering matters from Multilevelnet.
Angela posted on Friday, October 09, 2015 - 1:55 pm
I am running a model using type=complex and I would like to look at some interaction effects. I read on the discussion board that when running a two-level model, centering should occur after creating the interaction variables in the define statement. However, I am not looking at effects across levels, so I was not sure if this applied to my model. At what point should I center my variables when looking at interaction effects in a multilevel model?
Type=Complex is not a 2-level model but a single-level model. With single-level models it is not required to center variables, but if it is done it should be before creating the interaction.
JLuk posted on Sunday, December 13, 2015 - 7:29 pm
Cross-Level Interaction in Multilevel ZIP Model
1. I am running a two-level zip model, with drinking being the outcome. I'm interested in testing a cross-level interaction. Can this be done in Mplus (both for the zero-inflation and count part)?
2. I adapted syntax from example 9.2, with the following key changes: - VARIABLE: a zip model is specified by "count is drink(i)" - MODEL: %Within% s | drink on x; si | drink#1 on x; %Between% drink s on w xm; drink with s; drink#1 si on w xm; drink#1 with si;
Does this look right?
3. Is the plotting function for cross-level interaction (second part of example 9.2) robust while using ZIP?
JLuk posted on Tuesday, December 15, 2015 - 6:40 pm
Great! Thank you so much, Dr. Muthen!
JLuk posted on Monday, December 21, 2015 - 12:41 pm
Cross-Level Interaction in Multilevel Zero-Inflated Model
1. In running a cross-level interaction, I compared using ZIP vs. ZINB models. It appears that the multilevel ZIP model ran, but the ZINB model did not. It gave the following error message: *** FATAL ERROR Internal Error Code: GH1006. An internal error has occurred. Please contact us about the error, providing both the input and data files if possible.
I think using ZIP model would be justifiable given similar BIC. However, I'm just curious why the model did not run with ZINB.
2. In the syntax in the previous post: - MODEL: %Within% s | drink on x; si | drink#1 on x; %Between% drink s on w xm; drink with s; drink#1 si on w xm; drink#1 with si;
If I would like to include other covariates in the within-level, do I simply specify: %Within% s | drink on x covar1 covar2; si | drink#1 on x covar1 covar2;
3. I'm using Mplus on a Mac and am realizing that the plot function may not work on Mac. Is that still the case with the latest version? If so, any alternative resources that you'd recommend to probe the interaction?
I have a question related to your Dec 9, 2011 2:22 post. I am running a multilevel regression model and getting different ICCs depending on which predictor variables are in my model (e.g., models with and without a moderator variable). In your previous post, you explained:
"Usually the ICC changes with the covariates due to this misspecification where a covariate is on the within list but actually it is not a within level variable because it hasn't been centered. You can use this command to fix this misspecifcations: centering=GROUPMEAN(x); for all x variables that are on the within= list.
The only x variables I have not been centering are a binary treatment variable (treatment = 1 vs control = 0) and my interaction term because both have a meaningful zero. If I center these variables, I believe I will no longer be able to easily interpret the intercept as the score for control participants with average (due to centering) scores on all other predictors.
What is your recommendation in this situation? Which ICCs should I report and why?
I recall reading that it has become possible to order define commands so that centering occurs before computation of interactions. However, I cannot seem to find this information in the user's guide or on the discussion board. Could you please speak to how I can do this, if possible?