1,579 views

Skip to first unread message

Apr 9, 2019, 8:23:23 AM4/9/19

to lavaan

Hi All,

I was hoping someone here would be able to help me with formulating a 2-level multiple mediatIon model with random intercept in Lavaan. I understand that I have to use the 'cluster' statement in lavaan so specify my clusering variable and that I have to explicitly tell the model which regressions are at level 1 or level 2, but I am really struggling to do this when trying to compute the indirect and direct effects for the mediation part of my model.

My exposure of interest is a binary treatment group ( i.e. "group"), and the outcome is a variable that represents intention to quite smoking (intent_scale ). The relationship between these two variables is potentially mediated by 2 variables : vulnerability (vuln_scale_centred) and self-efficacy (se_scale_centred). (Self-efficacy has one covariate (mean_se_scale))

Ignoring the hierarchical structure of my data, the model I am trying to fit looks like this:

multipleMediation <- '

intent_scale ~ b1 * vuln_scale_centred + b2 * se_scale_centred + c * group

vuln_scale_centred ~ a1 * group

se_scale_centred ~ a2 * group +d*mean_se_scale

indirect1 := a1 * b1

indirect2 := a2 * b2

total := c + (a1 * b1) + (a2 * b2)

vuln_scale_centred ~~se_scale_centred # residual covariance between the 2 mediators

'

Now I am really struggling to modify the syntax above to reflect the nested structure of my data:

Intent_scale (my outcome) and the two mediators ( vuln_scale_centred and se_scale_centred) have actually been measured multiple times per person. So I need to specify participants 'subjectID' as a "cluster". So the level 1 is the observation level ( within-person) and the level 2 is the "ID" level ( i.e. between-persons). However, my primary exposure treatment "group" is not a level 1 variable, each person was assessed to a single group ( treatment vs. placebo) so it's a level 2 variable. I believe that in multilevel SEM notation, my model would be a 2-1-1 (except there is 2 mediators, both at level 1).

My attempt at formulation this model is below, but I am really not sure I have specified it correctly. Would anyone be able to provide any input on my formulation and whether or not it is specifying a 2-1(1)- 1 model correctly? What i am struggling with most, is where i should specifying my within-cluster mediators "vuln_scale_centred ~ a1 * group" and "se_scale_centred ~ a2 * group" below. Should it be under level 1 or level 2? Since "intent_scale" is an observation level variable, but "group" is a between cluster variable? Any help or suggestion would be greatly appreciated

MultilevelMultipleMediation model1 <- '

level: 1

intent_scale ~ b1 * vuln_scale_centred + b2 * se_scale_centred # within-person model (observation level outcome and mediators)

vuln_scale_centred ~ a1 * group

se_scale_centred ~ a2 * group

level: 2

intent_scale ~ c * group # between-person model: group predicts between-subject difference in outcome ( at the ID level)

vuln_scale_centred ~~ vuln_scale_centred

se_scale_centred~~se_scale_centred

indirect1 := a1 * b1

indirect2 := a2 * b2

total := c + (a1 * b1) + (a2 * b2)

vuln_scale_centred ~~se_scale_centred # residual covariance between the 2 mediators

'

# regular fit:

er.multilevel.mediation <- sem(MultilevelMultipleMediation model1, data = er[complete.cases(er),], cluster = "subjectID",

verbose = TRUE)

Thanks a lot for your help.

Best,

Marie-Jeanne BUSCOT

Apr 9, 2019, 1:29:54 PM4/9/19

to lav...@googlegroups.com

Without commenting on your model specifically, I find it helpful to work with and replicate examples in the literature before moving on to my own data. I assume you are working Kris Preacher’s models, yes? If so, you’ve probably already seen the syntax for the MSEM 2-1-1 model in Mplus here: http://quantpsy.org/pubs/syntax_appendix_081311.pdf.

From what I can tell, mediation is calculated at the between level, even for a 2-1-1. I used data from the Mplus website and modeled it in lavaan (a) to reproduce the MSEM in Mplus, and (b) estimate a 2-1-1 model with a single mediator. I assume this will scale to multiple mediation. Here’s my lavaan code:

data0 <- read.table("http://www.statmodel.com/usersguide/chap9/ex9.1a.dat”)

#I changed the Mplus names slighly to reflect the 2-1-1 syntax in Preacher

colnames(data0) <- c("y", "m", "x", "xm", "clus")

library(lavaan)

#reproduce the MSEM example in the Mplus user guide

mp0 <- '

level: 1

y ~ m

level: 2

y ~ x + xm'

mp0.out <- sem(mp0, data = data0,

cluster = "clus")

summary(mp0.out)

#the 2-1-1 model, based on Preacher's Mplus MSEM 2-1-1 example

mp1 <- '

level: 1

y ~ m

level: 2

m ~ a*x

y ~ b*m

y ~ x

#calculate the indirect effect

indb := a*b'

mp1.out <- sem(mp1, data = data0,

cluster = "clus")

#get CIs (tho not bootstrapped)

summary(mp1.out, ci = T)

Hope this helps with your data analysis problem.

Joe

--

You received this message because you are subscribed to the Google Groups "lavaan" group.

To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.

To post to this group, send email to lav...@googlegroups.com.

Visit this group at https://groups.google.com/group/lavaan.

For more options, visit https://groups.google.com/d/optout.

Apr 24, 2019, 11:23:03 PM4/24/19

to lavaan

Hello Joe,

Thanks a lot for your answer. I am a little bit puzzled by the difference between the Mplus MSEM model 2-1-1 fitted in section E. page 3 of the pdf (http://quantpsy.org/pubs/syntax_appendix_081311.pdf) and traditional 2-1-1 model (traditional MLM) in section C. (page 2).

The only difference between the 2 it appears is that in the MSEM version the slope when regressing y on m at level-1 is not constrained to be equal to "b" (%WITHIN% y ON m and %BETWEEN% y ON m(b)), while in the MLM version this level 1 slope is constrained to be equal to the slope calculated at the between level ( i.e %WITHIN% y ON m (b) and %BETWEEN% y ON m(b)).

I fitted the two different models in LAVAAn as follows :

MSEMversion <- '

level: 1

y ~ m

level: 2

m ~ a*x

y ~ b*m

y ~ x

# indirect effect

indb := a*b'

ad :

MLMversion <- '

level: 1

y ~ b*m

level: 2

m ~ a*x

y ~ b*m

y ~ x

# indirect effect

indb := a*b'

and the results are WIDELY different!!! in the MSEM version the freely estimated slope at the between level is not significant at all, while it is highly significant in the MLM version when contrained to be equal the level-1 slope.

Would you be able to explain what is correct specification?

Thanks a lot

To unsubscribe from this group and stop receiving emails from it, send an email to lav...@googlegroups.com.

Apr 26, 2019, 3:49:28 AM4/26/19

to lavaan

the results are WIDELY different!!!

That is the whole point of the article you linked to. It is not always (or even usually) reasonable to assume the causal process are identical at different levels of measurement.

Would you be able to explain what is correct specification?

It seems like you just explained to us that the slopes should be allowed to differ, because the results differ so much. But it is an empirical question. Test the null hypothesis of equivalence by passing both models to lavTestLRT(). If the *p* value is smaller than your alpha level, reject the null.

Terrence D. Jorgensen

Assistant Professor, Methods and Statistics

Research Institute for Child Development and Education, the University of Amsterdam

Message has been deleted

Jul 8, 2019, 1:02:41 PM7/8/19

to lavaan

Hi all,

I am also trying to formulate a multilevel SEM mediation model (2-2-1) with the cluster statement but am finding it a bit tricky to convert the syntax from Mplus to lavaan. My model has a single (observed) level 1 outcome variable, a level 2 latent mediator factor (‘mf’; defined by five observed variables), and a level 2 latent x factor (‘xf’; defined by three observed variables). My clustering variable is ‘ID’ and I also have a level 1 covariate (‘baseline’).

So far my syntax looks like this:

library (lavaan)

model1 <- ‘

level: 1

outcome ~~ baseline

level: 2

xf =~ x1 + x2 + x3

mf =~ m1 + m2 + m3 + m4 + m5

outcome ~ xf + mf

'

fit_model1 <- sem(model=model1,data=mydata, cluster='ID')

summary(fit_model1)

Does this look appropriate? If not, any advice or guidance is much appreciated!

Many thanks,

Elizabeth

Jul 9, 2019, 8:35:53 AM7/9/19

to lavaan

level: 1

outcome ~~ baseline

level: 2

xf =~ x1 + x2 + x3

mf =~ m1 + m2 + m3 + m4 + m5

outcome ~ xf + mf

Don't forget to regress outcome on baseline at Level 2 too (any level 1 variable has a level-2 component).

Sep 30, 2019, 8:12:33 AM9/30/19

to lavaan

Hello everyone,

I have something pretty similar going on but I would be grateful for any advice on whether I specified the model correctly:

- I have a clustering-variable "V"

- I have a level-2 predictor (observed): "group_time"

- I have a level 1 predictor (observed): time

- I have a mediator that is measured at level 1 with 4 items (s. below) but can be interpreted at level 1 and level 2: K1

- I have a level 1 outcome variable (both measurement with 3 items and interpretation do only make sense at level 1): IE2

Now I was wondering

1) whether the specification below is correct?

2) specifically with respect to the 2-2-1 mediation (group_time -> K1 -> IE2), wether I should specify something like indirect := ba*wb?

3) related to that: do I interprete the b-path at level 2 for the "group_time -> K1 -> IE2"-mediation?

I would appreciate your opinion! Thank you in advance!

Best Franzi

SEM <- '#measurement model

level: 1

IE2w =~ e*RF2IE1 + f*RF2IE2 + g*RF2IE3

K1w =~ a*RF1K1 + b*RF1K2 + c*RF1K3 + d*RF1K4

IE2w ~ wb*K1w +wc*time

K1w ~ wa*time

level: 2

IE2b =~ e*RF2IE1 + f*RF2IE2 + g*RF2IE3

K1b =~ a*RF1K1 + b*RF1K2 + c*RF1K3 + d*RF1K4

level: 1

IE2w =~ e*RF2IE1 + f*RF2IE2 + g*RF2IE3

K1w =~ a*RF1K1 + b*RF1K2 + c*RF1K3 + d*RF1K4

IE2w ~ wb*K1w +wc*time

K1w ~ wa*time

level: 2

IE2b =~ e*RF2IE1 + f*RF2IE2 + g*RF2IE3

K1b =~ a*RF1K1 + b*RF1K2 + c*RF1K3 + d*RF1K4

K1b ~ ba*group_time

IE2b ~ bb*K1b + bc*group_time

# indirect

wi:= wa*wb

bi:= ba*bb

#total

ti:=(ba*bb)+bc

wti:=(wa*wb)+wc

'

Oct 2, 2019, 11:16:27 AM10/2/19

to lavaan

1) whether the specification below is correct?

Mostly, but you have omitted the between-component of time from your level-2 model, which might incorrectly assumes it is uncorrelated with everything else at level 2.

2) specifically with respect to the 2-2-1 mediation (group_time -> K1 -> IE2), wether I should specify something like indirect := ba*wb?

No. Process at different levels are independent, they do not cross levels.

Preacher, K. J., Zyphur, M. J., & Zhang, Z. (2010). A general multilevel SEM framework for
assessing multilevel mediation. Psychological Methods, 15, 209-233.

Preacher, K. J., Zhang, Z., & Zyphur, M. J. (2011). Alternative methods for assessing mediation
in multilevel data: The advantages of multilevel SEM. Structural Equation Modeling, 18, 161-
182.

3) related to that: do I interprete the b-path at level 2 for the "group_time -> K1 -> IE2"-mediation?

Like any other indirect effect, but involving group means. Read the articles above to learn about these models.

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu