1

I am currently running a serial medaition where my IV is multicategorical with 3 levels, while my moderators and DV are continuous. I created 2 dummy variables for my IV. Therefore in my output I see hwo they compare for different variabels to their reference group. However now I am wondering how I can test how the 2 levels compare to each other, so the 2 levels that are nto the reference group. Normally I would use pariwise comparison but I could not find anything similar for lavaan.

This is my model:

model1 <- 'beliefCT_mean ~ c*pattern_mean + g*effectance_mean + f1*exposure_No +       f2*exposure_Topic + i1*Age + i3*believer\n 

effectance_mean ~ a1*exposure_No + a2*exposure_Topic \n
pattern_mean ~ b*effectance_mean + d1*exposure_No + d2*exposure_Topic + j*believer\n
indirect_1 := a1*b*c\n
indirect_2 := a2*b*c\n
indirect_3 := a1*g\n
indirect_4 := a2*g\n
indirect_5 := d1*c\n
indirect_5 := d2*c\n
Total_ := a1*b*c + a2*b*c + a1*g + a2*g + d1*c + d2*c+ f1 + f2\n

fit1 <- sem(model1, final, se = "bootstrap", bootstrap = 1000)

exposure is my IV(levels, no, Topic, CT(reference)
effectance => M1
pattern => M2
beliefCT => DV

2 Answers2

0

how I can test how the 2 levels (that are not the reference group) compare to each other

As you noted, a dummy-code's slope is a (conditional) mean difference, compared to the reference group. So

  • a1 is the mean difference between exposure_No and the reference group (μ1 − μ3)
  • a2 is the mean difference between exposure_Topic and the reference group (μ2 − μ3)

The mean-difference between any other groups (represented by dummy codes) is the difference between their slopes, because the common reference-group mean (μ3) cancels out: (μ2 − μ3) − (μ1 − μ3) = μ2 − μ3 − μ1 + μ3 = μ2 − μ1. In your lavaan syntax, you can add that difference as a user-defined parameter:

a2_vs_a1 := a2 - a1

The multiple-groups approach is also an option.

https://doi.org/10.3389/fpsyg.2017.00747

https://doi.org/10.3758/s13428-022-01996-0

Terrence
  • 780
  • 4
  • 7
0

To compare the two groups to each other, you can simply change the reference group. That means creating one more dummy variable (for the previous reference group) and running the model again with that group and one of the others.