Longitudinal mediation PreviousNext
Mplus Discussion > Structural Equation Modeling >
 Jean Bradley posted on Friday, April 03, 2009 - 10:11 pm
I am assessing longitudinal mediation. I am new to MPLUS and am in need of some advice/guidance to make sure my code is correct & that my models include everything they should (and should not). I have 3 time points (1,2,3), X=intervention group assignment, M=mediator, and Y= outcome. Here is what I have for code:

names are X M1 M2 M3 Y1 Y2 Y3;

use variables are X M1 M2 Y1 Y2 Y3;
missing are all (-99);

Type = missing h1 meanstructure;
bootstrap = 1000;

M2 on X M1;
Y2 on Y1 X;
Y3 on Y2 M2 X;

Model Indirect:
Y3 on M2 X;

1. My first question is do I need to include a "with" statement, and if so, which variables should be included?

2. Can the following model statements be combined, or is it correct to separate them?
Y2 on Y1 X;
Y3 on Y2 M2 X;

OR combined to

Y3 on Y2 M2 Y1 X; (and should M1 be included in this statement as well if I should combined them?)

I appreciate any help you can provide! I do have MacKinnon's mediation book which has been great, but I am unsure about this issue based on his chapters.
 Bengt O. Muthen posted on Saturday, April 04, 2009 - 4:32 pm
1. y2 and m2 should have a residual covariance, so if you don't see that in the Mplus output you should add it. For the other DVs you cannot identify residual covariances because they are already regressed on each other.

Btw, are you sure you don't want to regress y2 on M1?

2. No you cannot combine them as you write it - your combined statement does not express y and m2 as dependent variables (dependent variables appear on the left-hand side of ON).
 Jean Bradley posted on Monday, April 27, 2009 - 5:49 pm
Dr. Muthen,
Thanks for your response, it was VERY helpful.
I get confused about specifying residual covariances. It looks like they only need to be specified among independent variables.. is that correct? This is already being done by MPLUS for DVs? Also, I have been told that the means, variances, or covariances of observed exogenous variables should not be included in the MODEL command... does this mean that I do not need to include the DVs in the WITH statements? Or am I misunderstanding?

Finally, the model above looked at only a single mediator and at true longitudinal relationships only. I am now extending the autotregressive model to include multiple mediators, and both longitudinal and contemporaneous relationships (2 lagged).(I am only including 2 mediators below but will be examining more in the actual models). Would you mind taking a look to see if my code is right (ON statements and WITH statements)?

M = mediator A (T1 T2 T3)
N = mediator B (T1 T2 T3)
X = group assignment
Y = outcome variable (T1 T2 T3)

M2 on X M1;
N2 on X N1;
M3 on X M2
N3 on X N2
Y2 on Y1 X M2 M1 N2 N1;
Y3 on Y2 X M3 M2 N3 N2;

M2 with N2 Y2;
N2 with Y2;

M3 with N3 Y3;
N3 with Y3;

Model Indirect:
Y3 on M2 X;(longitudinal relationship)
Y3 on M3 X;(contemporaneous relationship)
Thanks--- Jean
 Linda K. Muthen posted on Tuesday, April 28, 2009 - 10:40 am
Observed exogenous variables are independent variables and their means, variances, and covariances should not be included in the MODEL command.

Your WITH statements should be:

M2 with N2;
M3 with N3;

You cannot use the same pair of variables in both ON and WITH statements. Both parameters cannot be identified.
 Jean Bradley posted on Tuesday, April 28, 2009 - 12:04 pm
Thanks Dr. Muthen, again very helpful, and I appreciate your time and willingness to help a new user! I just want to confirm that I am understanding your comments above correctly. I include the observed exogenous variables in the ON statements (as shown above and below), but do not include them in the WITH statements, correct? So if I change my WITH statements, as suggested above, and shown below, is this Model command written correctly?

M2 on X M1;
N2 on X N1;
M3 on X M2
N3 on X N2
Y2 on Y1 X M2 M1 N2 N1;
Y3 on Y2 X M3 M2 N3 N2;

M2 with N2;
M3 with N3;

Thanks a lot... Jean
 Linda K. Muthen posted on Tuesday, April 28, 2009 - 4:08 pm
 Jean Bradley posted on Sunday, May 03, 2009 - 1:17 pm
I have a follow-up question with the Bengt O. Muthen posted on Saturday, April 04, 2009 - 4:32 pm post above.

You said that M2 and Y2 should have a covariance structure. When I run the model, it does not. Should I specify this in a WITH statement?

M2 on X M1;
Y2 on Y1 M1 X;
Y3 on Y2 M2 X;

Y2 with M2?

 Bengt O. Muthen posted on Sunday, May 03, 2009 - 3:37 pm
 Jean Bradley posted on Tuesday, May 05, 2009 - 8:56 am
Thanks Dr. Muthen,
I looked at my output again, and this is what it reads (without specifying M2 with Y2)
FRIEND24 0.045 0.013 3.442

FRIEND06 0.000 0.222 0.001
FRIEND24 2.062 0.302 6.823
FIT06R 1.669 0.263 6.357
FIT24R 1.598 0.262 6.107

Residual Variances
FRIEND06 0.275 0.020 13.674
FRIEND24 0.512 0.039 13.228
FIT06R 0.100 0.007 13.984
FIT24R 0.101 0.008 13.418

Does this mean that these 2 variable do have a residual covariance, so there is no need to specify M2 with Y2? I did not specify friend24 WITH fit24R but MPLUS automatically did it... I think it is a default. I wasn't sure if I should also see Fit06R WITH friend06 as well, or if this is correct. Thanks again. I know this is picky, but I want to make sure my models are correct.
 Bengt O. Muthen posted on Tuesday, May 05, 2009 - 7:34 pm
Yes, Mplus gives some WITH statements by default, but some others need to be given by the user - such as M2 WITH Y2 in this case. What you don't see in the output is not used in the model. So since you don't see M2 WITH Y2 you have to specify it. Once you have specified it in the input, it will show up in the output.
 Jean Bradley posted on Wednesday, May 06, 2009 - 7:50 am
Great! Thanks!
 anonymous Z posted on Friday, September 25, 2015 - 2:19 pm
Drs. Muthen,

I have a longitudinal data set including five time points. Basically, I want to see how x influences Y through M.

X (including 5 time points): relationship status change. The participant can be in relationship at time 1, and out of relationship at time 2, and back in relationship at time 3, and so on and so forth. How to model relationship status change (this is a dichotomous variable) in Mplus?
Y: including 5 time points
M: including 5 time points

I am not sure how to model this with Mplus.

Could you provide any advice?

Thank you very much!
 anonymous Z posted on Tuesday, October 06, 2015 - 8:17 am
Dear Drs. Muthen,

I posted a question on Sep 25. I appreciate if you could provide any guidance in regard to that questions.

Thanks so much!
 Bengt O. Muthen posted on Tuesday, October 06, 2015 - 5:46 pm
Sorry we missed this one.

I am not sure. Perhaps you can get inspiration from our Topic 3 handout, slides 157-159.

You may also want to ask on SEMNET.
 Brittany Rudd posted on Monday, February 06, 2017 - 6:33 am

I am testing a cross-sectional mediation model with 1 binary IV, 1 ordinal mediator, and 5 latent IVs. I'm using ML with 5000 bootstraps. I am using the Model Constraint command to test the indirect effect:

New (ab);
ab = a*b;

My questions are:

1. Can I test the mediation of the IV on all 5 latent outcomes simultaneously or do I need to run the model 5 times, once for each outcome?

2. If I can test simultaneously, can you point me in the right direction concerning MPlus code for these model?

3. I also plan to test this model as a longitudinal panel model (I have 3 waves of data). So same questions (1 and 2) regarding a panel version of this model.

Thank you very much in advance for your help.
 Bengt O. Muthen posted on Monday, February 06, 2017 - 8:25 am
1-2. You said "5 latent IV's" but I think you meant 5 latent DVs. Running them one at a time gives the same answer as running them all together.

Note that special modeling is needed with an ordinal mediator - see our new Regression and Mediation book. As explained there, ML isn't the best estimator for this. Bayes is good and WLSMV is also possible.

3. In the longitudinal setting new questions arise - e.g. y_t is influenced by m_t or m_t-1?

See also Maxwell et al 2011 in MBR.
 Asier Maņas posted on Sunday, September 02, 2018 - 10:00 pm

I have a longitudinal data set including 2 time points. Basically, I want to see how X influences Y through M.
Sorry for the mistakes that may be, but I am a new user of MPLUS.

M = mediator (T1 T2)
X = independent variable (T1 T2)
Y = outcome variable (T1 T2)

M2 ON X1 X2 M1
Y2 ON M1 M2 Y1
Y2 ON X1 X2 Y1
Y2 ON Y1 X1 X2 M2 M1

1. I would like to know if the model is made in the correct way.
2. How could I do a longitudinal moderated mediation (W1 and W2)? Is there a template to fit this analysis?

Thank you very much in advance for your help.
Asier M.
 Bengt O. Muthen posted on Monday, September 03, 2018 - 2:03 pm
This is a large and complex topic. I would recommend that you take a look at the methodological literature in psychology. For a recent example, see

Laughlin et al (2018) in MBR "Cross-sectional analysis of longitudinal mediation...".

as well as articles by Maxwell and others on longitudinal mediation.
 TJ posted on Tuesday, April 07, 2020 - 7:43 pm
I am trying to run a longitudinal mediation model and I can't seem to run my model. I have an Latent Independent variable that is measured across 3 time points, denoted by F1.F2.F3 (measurement model).


F1 BY s1 a1 d1 b1;
F2 BY s2 a2 d2 b2;
F3 BY s3 a3 d3 b3;

I1 S1 | F1 F2 F3;

I2 S2 | af1 af2 af3;

I3 S3 | pf1 pf2 pf3;

I4 S4 | n1 n2 n3;

I4 ON I1 I2 I3;
I2 ON I1;
I3 ON I1;
I4 ON I2 I1;
I4 ON I3 I1;

I1 S1 ON sex age BO dx inc edu;
I2 S2 ON sex age BO dx inc edu;
I3 S3 ON sex age BO dx inc edu;
I4 S4 ON sex age BO dx inc edu;


*** ERROR in MODEL command
To declare random effect variables, TYPE = RANDOM must be specified
in the ANALYSIS command.

When I changed my analysis command, I dont get an output either. Is there an issue with my model?
 Bengt O. Muthen posted on Wednesday, April 08, 2020 - 4:20 pm
We need to get your full input and data - send to Support along with your license number.
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