Multiple mediation model with a dichotomous predictor

234 views
Skip to first unread message

Marek Veneny

unread,
Apr 27, 2022, 1:28:01 PM4/27/22
to lavaan
Hello guys,

I'm trying to specify the following model in lavaan:

mediation model.png

Where condition is binary (either control or experimental group); and where both the mediators (habits, attitudes, system) and the outcome variable (intention) are all measured on a scale ranging from 1 to 7 ("not at all - very")*.

(*a quick aside here: can the scale be treated is continuous instead of ordinal? Would I want that? If so, why? If not, why not?)

Basically, what I'm trying to see is whether the link between condition and intention remains significant after controlling for the mediators.

(I used the approach they used here. I attach their supplementary material. On page 12 and 13 is their mediation model.)

I could produce the above plot using lavaanPlot with the following model specifications, which I modelled after this tutorial:

multimedmed <- '#direct effect
intention~b1*habits+b2*attitudes+b3*system+c*condition
#mediators
habits~a1*condition
attitudes~a2*condition
system~a3*condition
indirect1:= a1*b1
indirect2:= a2*b2
indirect3:= a3*b3
#total effect
total:=c+(a1*b1)+(a2*b2)+(a3*b3)
habits~~attitudes
habits~~system
system~~attitudes'

However, to let the model run, I simply changed the condition from a factor to numeric (which is not interpretable, I think) to avoid the "unordered factor(s) with more than two levels detected as exogenous covariate(s): condition" error, as I wanted to simply specify the model for a preregistration of a student project, without actually having the data yet (I just needed the graphic).

Having the data now, I noticed on lavaan website that one must specify the exogenous categorical variables as dummy variables, which I could do for my dataset using psych's package dummy.code function. 

Where I'm lost (due to not really understanding the machinery) is how to adapt the above model, which has the groups collapsed into one variable, into one where the two groups are used instead. 

Any help with specifying the model is appreciated (as well as any other resources that could help me do so - I really don't understand the syntax for the mediation model in lavaan).

barriers S&W.docx

Christian Arnold

unread,
Apr 28, 2022, 4:33:06 AM4/28/22
to lav...@googlegroups.com
Isn't this an almost prototypical use case for a multi-group analysis? What is the advantage of your modeling?



--
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 view this discussion on the web visit https://groups.google.com/d/msgid/lavaan/d8646f1a-48a3-40b8-b8b0-7d9570b988c3n%40googlegroups.com.

Terrence Jorgensen

unread,
May 4, 2022, 12:10:22 PM5/4/22
to lavaan
can the scale be treated is continuous

Yes, that's the point of a Likert scale.  And most research on the subject converges on the conclusion that with as many as 7 scale points, there is only negligible difference between standardized solutions when treating it as ordinal (with underlying continuum) or continuous.
 
what I'm trying to see is whether the link between condition and intention remains significant after controlling for the mediators.

This doesn't sound like a hypothesis of mediation.  You would only need to include the "mediators" as covariates when testing the effect of the grouping variable (e.g., a standard ANCOVA).  If you are interested in testing the indirect effects, then your hypotheses go beyond merely "controlling for" mediators.

I simply changed the condition from a factor to numeric (which is not interpretable, I think)

Yes it is.  Any nominal variable can only be represented in statistical models by (combinations of) numerical codes, unless you fit separate models per group.  Read any introductory regression modeling textbook about dummy codes, effects codes, and a variety of contrast codes.

Where I'm lost (due to not really understanding the machinery) is how to adapt the above model, which has the groups collapsed into one variable, into one where the two groups are used instead. 

A dummy code has 2 levels.  For example, you can code it so 1 = treatment group and 0 = control group.  The effect of the dummy code is therefore a difference in intercepts (or means, when it is the sole predictor).

Terrence D. Jorgensen
Assistant Professor, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

Reply all
Reply to author
Forward
0 new messages