Interaction in two-level model with r... PreviousNext
Mplus Discussion > Multilevel Data/Complex Sample >
Message/Author
 Shuwen Tang posted on Friday, November 02, 2012 - 10:08 am
I want to examine a two-level model with random slopes. Usually I just use the "S | y on X" statement in the within model. But this time I want to use the within-part of X as the predictor. Instead of group-mean-centering X, I would like to use the latent variable approach. I tried the following syntax:


%WITHIN%
FXw by x @1;
x@0;
S| Y ON FXw ;
%BETWEEN%
FXb by x@1;
x@0;
S Y on T;

I got the error message saying that "THE ESTIMATED WITHIN COVARIANCE MATRIX COULD NOT BE INVERTED."

Is there anything fundamentally wrong with this model? I appreciate your thoughts and input!
 Linda K. Muthen posted on Friday, November 02, 2012 - 1:52 pm
See the third part of Example 9.2 where the input for this is shown.
 Shuwen Tang posted on Friday, November 02, 2012 - 4:00 pm
Thanks, Linda. In the example 9.2, I can only get an overall interaction estimation. What we want to see is to separate the interaction term into between and within parts. Do you have any ideas to get these using the latent variable approach, instead of group-mean-centering X?
 Shuwen Tang posted on Tuesday, November 06, 2012 - 10:12 am
Or, how to deal with the error message saying that "THE ESTIMATED WITHIN COVARIANCE MATRIX COULD NOT BE INVERTED." Is there anything fundamentally wrong with the model I mentioned above? Thanks.
 Linda K. Muthen posted on Tuesday, November 06, 2012 - 11:35 am
Regarding using only the within part of the latent variable decomposition as a covariate in the random slope, this is not possible.

Regarding the error message, please send the output and your license number to support@statmodel.com.
 Shuwen Tang posted on Tuesday, November 06, 2012 - 12:22 pm
why it is not possible? Example 9.10 shows a model in which a within latent variable is used as a covariate in the random slope. How is our model different from that example, except that we only have one indicator for the latent factor?
 Linda K. Muthen posted on Tuesday, November 06, 2012 - 1:42 pm
Please send the full output and your license number to support@statmodel.com.
 Linda K. Muthen posted on Friday, November 16, 2012 - 12:31 pm
Try fixing x at 0.0001 on both levels.

x@0.0001;
 John C posted on Monday, December 19, 2016 - 12:04 pm
Hello,

I would like to do a cross-level interaction model, i.e., I want to check if a cluster-level variable predicts the “slope” of a within-level predictor.

However, my outcome is binary.

Can this be done? If so, is this the same specification as with a continuous outcome except for declaring the dependent variable as categorical?

John C.
 Bengt O. Muthen posted on Monday, December 19, 2016 - 6:03 pm
That's right.
 Kimberly Hall posted on Thursday, January 12, 2017 - 1:21 pm
Hello,

I'm currently attempting to estimate a two-level longitudinal model (data are clustered within person), and am modeling my syntax off of Example 9.16 in the Mplus 7.0 manual.

I'd like to predict the random slope using another within-subjects variable and tried the following syntax:

%WITHIN%
s | SC on trial;
s on Phase;

But received an error message stating that the latent variable declared on the between level cannot be used on the within level. Is there a way to specify both within- and between-subject variation for a random slope using this syntax? If not, is there a different example you suggest?

Thank you in advance for your help!
 Bengt O. Muthen posted on Thursday, January 12, 2017 - 1:42 pm
The random slope varies across the between-level units, so no variation within. You can use the between-level variation part of Phase to predict s on the Between level.
 Kimberly Hall posted on Friday, January 13, 2017 - 7:01 am
Thank you for your reply. Is it possible to predict within level variation in random slopes using example 9.14?

We are interested in examining differences in the rate of extinction over the course of two separate sessions (i.e., Phase). We thus included the trials for both sessions in one time variable and were hoping to structure our Level 1 analyses as follows:

B0 = intercept
B1 = linear effect of time
B3 = moderator effect of phase
B4 = linear time by phase interaction

What we are struggling with now is how create the B4 term. Any suggestions are greatly appreciated.
 Bengt O. Muthen posted on Friday, January 13, 2017 - 5:22 pm
If you don't have too many time points within each phase you can do your growth modeling in single-level, wide format and let phase be represented via piecewise growth modeling - see UG ex 6.11.
 Christoph Schaefer posted on Tuesday, December 04, 2018 - 8:22 am
Dear Linda, dear Bengt,

I am currently trying to replicate the second part of Example 9.2, using Mplus 8.1; i.e., a cross-level interaction where a cluster-level covariate moderates an influence of a within-level covariate.
At first, I got the message that the command "type= twolevel random", which I took from Example 9.2, has to be combined with Bayes-Estimator. Is this always the case?
After setting the Estimator on Bayes, I got the message "Mplus diagrams are currently not available for multilevel analysis. No diagram output was produced."

Best wishes,
Daniel Schaefer


My syntax is the following:

WITHIN = EquPop AchPop NeePop UniNJ ZIncome Age Gender;
BETWEEN = MehrMind EquPopG;
CLUSTER = cluster;

DEFINE: CENTER EquPop (GROUPMEAN);


ANALYSIS:
TYPE = TWOLEVEL RANDOM;
ESTIMATOR=BAYES;

MODEL:

%WITHIN%
s | RespPop ON EquPop AchPop NeePop UniNJ ZIncome Age Gender;

%BETWEEN%
RespPop ON MehrMind EquPopG ;

[s] (gam0);
s ON MehrMind (gam1)
EquPopG;

RespPop WITH s;


MODEL CONSTRAINT:
PLOT(ylow yhigh);
LOOP(level1,-3,3,0.01);
ylow = (gam0+gam1*(-1))*level1;
yhigh = (gam0+gam1*1)*level1;
PLOT:
TYPE = PLOT2;
 Christoph Schaefer posted on Tuesday, December 04, 2018 - 8:58 am
Please ignore that comment above which regards the message on diagrams. (I've just found out that a plot is not a diagram.)
Just the question on the estimator setting is remaining.
 Bengt O. Muthen posted on Tuesday, December 04, 2018 - 3:14 pm
We recommend the Bayes estimator with random slopes because it makes possible latent variable decomposition on both levels (latent variable centering). See 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).
 Andreas Stenling posted on Wednesday, March 27, 2019 - 3:49 pm
I am estimating a two-level growth model and want to specify an interaction term using the between part of a within-level variable (PA) and a between-level variable (age) and include as a predictor of the intercept and slope factors at the between-level. I am using the Bayes estimator and was wondering if I can use the latent variable decomposition even though the interaction term is only used as a predictor at the between-level? For example, is it reasonable to specify the model below? The interaction term gets a variance at the within-level but it does not seem to influence other parameter estimates in the within part of the model (i.e., compared to a model without the interaction term). Or is it more reasonable to use the observed mean centering approach? The latent variable centering and observed mean centering yields slightly different results and I would be more inclined to use the latent variable centering approach if it is reasonable to do so. Any input would be much appreciated.

DEFINE: int=PA*age;
WITHIN: time qtime;
BETWEEN: age;
…………………………………………………………
MODEL:
%WITHIN%
LS | Fluency ON time;
QS | Fluency ON qtime;
Fluency ON PA;

%BETWEEN%
LS with Fluency; LS with QS; QS with Fluency;
Fluency LS QS ON PA Age int;


Cheers,
Andreas
 Bengt O. Muthen posted on Wednesday, March 27, 2019 - 4:23 pm
Twolevel XWITH using Bayes will be available in Mplus Version 8.3 to be released shortly after Easter. You can also use ML approaches described in this pfd by Preacher et al:

http://quantpsy.org/pubs/preacher_zhang_zyphur_2016_(code.appendix).pdf
 Andreas Stenling posted on Wednesday, March 27, 2019 - 4:51 pm
Ok, thanks! Then I think I'll wait for the XWITH option for Bayes twolevel models. In the meantime, can you comment on the example I provided above and whether that is a reasonable approach?

I've tried the Preacher et al. (2016) approach with ML but besides taking a very long time to estimate I run into some convergence problems, likely due to having several random effects.
 Bengt O. Muthen posted on Thursday, March 28, 2019 - 5:54 pm
So PA would be a group-mean centered within variable on Within and a cluster mean between variable on Between for which you would also create a PA*Age between-level interaction variable. Sounds ok.
Back to top
Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: