Multigroup Mediation Model

383 views
Skip to first unread message

Minh-Thanh Nguyen

unread,
Nov 14, 2023, 8:48:24 AM11/14/23
to lavaan
Dear all,
I'm a newbie in R. I'm writing syntax to run SEM for a multigroup multiple mediating variables model. My model has two independent variables (Conflict and enrich), two intermediate variables (practice and style), and one independent variable (stress). When I perform the analysis, I has been always received this error: "Warning message:In lavaanify(model = FLAT, constraints = constraints, varTable = lavdata@ov, : lavaan WARNING: using a single label per parameter in a multiple group setting implies imposing equality constraints across all the groups; If this is not intended, either remove the label(s), or use a vector of labels (one for each group); See the Multiple groups section in the man page of model.syntax."

I don't know how to solve this error and get indirect effect output for both groups (the group name is "country"). I'd love to receive your advice because I'm a newbie to R, and my understanding of lavaan is minimal. Your support is much appreciated.

My syntax is following:
# Define the model syntax
model <- '
  # Measurement model
    # Latent variables
      enrich =~ HE + WE
      conflict =~ HC + WC
      practice =~ PRACTICE
      style =~ DC + DD + NC
      stress =~ ST + SC + DP + AN
'
  # Structural model
    stress ~ b11*practice + b12*style + c11*enrich + c12*conflict

# mediator regression
practice ~ a11*enrich + a12*conflict
style ~ a21*enrich + a22*conflict

# mediator residual covariance
practice ~~ style

# effect decomposition
# y1 ~ x1
ind_x1_m1_y1 := a11*b11
ind_x1_m2_y1 := a21*b12
ind_x1_y1 := ind_x1_m1_y1 + ind_x1_m2_y1
tot_x1_y1 := ind_x1_y1 + c11

# y1 ~ x2
ind_x2_m1_y1 := a12*b11
ind_x2_m2_y1 := a22*b12
ind_x2_y1 := ind_x2_m1_y1 + ind_x2_m2_y1
tot_x2_y1 := ind_x2_y1 + c12
# Fit the model
fit <- sem(model, data = Data, group = "country")

# Summarize the results
summary(fit, standardized = TRUE, fit.measures = TRUE)

Jeremy Miles

unread,
Nov 14, 2023, 8:35:33 PM11/14/23
to lav...@googlegroups.com
It's not an error, it's a warning.

It's not saying there is something wrong. It's saying that what you did might be OK, but maybe you should make sure it is OK.
When you write:

    stress ~ b11*practice + b12*style + c11*enrich + c12*conflict

You are saying to Lavaan that you want the parameter for 
stress ~ practice 
To be called b11 and to be equal in both groups.  Lavaan thinks that's unusual and suggests that you might want them to be different (because you can always constrain them to be equal if you want to).

To do this, you need two labels. I don't know what your countries are, but if they were Yemen and Zambia, then you could write:

    stress ~ c(y_b11, z_b11) *practice + c(y_b12, z_b12) *style + c(y_c11, z_c11) * enrich + c(y_c12, z_c12) *conflict

Now you have a separate parameter for each country.

Jeremy




--
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/1f9c4585-6ad3-43f5-8334-3c12417fb1f5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages