Builds model for moderated mediation anaysis using SEM

buildModMedSemModel(
  xvar,
  mvars,
  yvar,
  xmmod = NULL,
  mymod = NULL,
  cmvars = NULL,
  cyvars = NULL
)

Arguments

xvar

independent variable (predictor)

mvars

vector of names of mediators

yvar

dependent variable

xmmod

moderator of a path(s)

mymod

moderator of b path(s)

cmvars

covariates for predicting the mediators

cyvars

covariates for predicting the dependent variable

Value

lavaan model to be used in moderatedMediationSem

Examples

model <-  buildModMedSemModel(xvar="procJustice", mvars= c("cynicism"),
          yvar = "CPB", xmmod = "insecure",mymod = "gender" ,cmvars =c("age"))