moderated mediation using lavaan with categorical moderator

Hi,

R newbie here!

I want to run a moderated mediation in R.
I have a continuous predictor, a continuous mediator and a continuous outcome. My moderator is categorical with 2 levels.

I know how to set mediation terms using lavaans but I'm not sure how to incorporate the moderator. Also, all examples tell me to grand mean centre the predictor, moderator and mediator but I can't grand mean centre my moderator because it is categorical.

here is how my mediation model would look using lavaans (i have named variables by their theoretical function for ease) :

med_mod <- 'outcome ~ c * predictor + b * mediator
mediator ~ a*predictor

                        indirect effect := a*b
                        total effect := c + (a*b) ' 

can anyone help and show me how I can adapt this to include the potential moderating effects of a categorical variable with 2 levels?

Thank you very much for your help <3

The {mma} has facilities for statistical Inference on mediation analysis with continuous or binary predictors at different level of the moderator, which can be continuous or categorical. See the related paper.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.