I'm completing a moderation mediation analysis in lavaan.
All of my variables are continuous other than my mediator, which is an ordinal with 3 levels (0,1,2). Lavaan can't handle interactions between ordinal and continuous variables, so I am troubleshooting the best way around this.
Some folks have suggested treating my ordered variable as pseudocontinuous, however with only 3 levels, I'm worried I'll get push back from reviewers. I could create the interaction term between the ordinal variable (but treated as continuous here) and the continuous outside of the model and then use it as a variable in the model while keeping the ordinal variable itself as ordered in the model.
Is there anything wrong with doing this? Any other suggestions?
data$int <- data$ordinal_cont * data$continuous
data[, "ordinal"] <- lapply(data["ordinal"], ordered)
model -> `
L1 =~ X1 + X2 + X3
L2 =~ Z1 + Z2 + Z3
L1 ~ a*L2 + c*Continuous + d*Ordinal + e*int
ordinal ~ b*L2
ab := a*b
L2 ~~ Continuous
L2 ~~ ordinal
Continuous ~~ ordinal
`
fit <- sem(model,
se = "bootstrap",
bootstrap = 2000,
data = data,
parallel = "snow",
ncpus = 8,
ordered = "pubertal_onset",
estimator = "DWLS")
Thanks,
Clare
Yes, the interpretations would not match:
Ordinal
would be on the continuous latent-response scalecontinuous
would be on the observed discrete-response scaleThe observed and latent responses don't share locations or scales, so you wouldn't actually be testing/interpreting an interaction effect.
A tedious, time-consuming, but very flexible option would be parameter moderation (often called moderated nonlinear factor analysis (MNLFA), but it is really more general than that). That is not available in
lavaan
, but it is available in theOpenMx
package:Kolbe, L., Molenaar, D., Jak, S., & Jorgensen, T. D. (2022). Assessing measurement invariance with moderated nonlinear factor analysis using the R package
OpenMx
. Psychological Methods. https://doi.org/10.1037/met0000501The tutorial is about testing invariance (which you should consider testing for your 2 common factors, one of which you consider to be affected by
Ordinal
and bycontinuou
). However, you can fit any kind of SEM (in your case, a simple mediation model at the structural level:L2
-->Ordinal
-->L1
) and have any model parameters (including variances) moderated bycontinuous
.