Direct and indirect effect of a categorical variable with more than 2 levels in a structural equation model I am new in SEM, and trying to figure out how to possibly get proportion of direct/indirect effect of a categorical variable with more than 2 levels over its total effect.
We have a categorical variable Intervention with 3 levels, coded as A1 and A2 dummy variables. We measure Outcome, and have another Mediator variable that mediates between the dummy variables and Outcome. Both continuous.
A1-> Outcome[label='a1']
A2-> Outcome[label='a2']
A1-> Mediator[label='b1']
A2-> Mediator[label='b2']
Mediator-> Outcome[label='c']


We are interested in the effect of Intervention to Outcome, and whether it is mediated through Mediator. We are using lavaan in R to calculate a path model, using the following formula
Outcome ~ a1*A1 + a2*A2 + c*Mediator
Mediator ~ b1*A1 + b2*A2

# computing parameters
direct := a1 + a2
indirect := b1*c + b2*c
total := direct + indirect
proportion := indirect/total


I am not sure if the computed parameters above, summing paths starting from each of the two dummy variables, have any meaning. In particular,

*

*Would "proportion" above be meaningful in terms of mediation?

*Is there any way here to consider the direct combined effect of the two dummy variables together as "Intervention"? Is the "direct" parameter above meaningful as the direct effect of intervention on outcome? If not in any absolute/magnitude terms, at least in terms of statistical significance?

I suspect (2) to be partially true, as the z and p-value associated to "direct" does not seem to change depending on how the dummy variables are coded (but the estimates do change), so it seems to refer to the intervention itself. Similarly for (1), "proportion" is constant across codings. But I am still unsure whether/how any this is meaningful.

I don't think it makes sense, because your choice of reference category is arbitrary.
Imagine you were just interested in the effect from A to Mediator. The means might be:

*

*group 0: 0

*group 1: 1

*group 2: 2

If you pick 0 as the reference category, b1 = 1, b2 = 2. If you pick 1 as the reference category, b1 = -1, b2 = 1. Clearly these lead to different sums, when the models are equivalent, and should not lead to different solutions.
If people combine multiple category effects in this way, they so it with $R^2$ or $\eta^2$, but I don't think that makes sense with a mediation effect.
