Is it possible to use the probe2WayMC function of semTools when sem(ordered="dep"), or only when the DV is continuous? I've tried it but I'm receiving this error message: Error in est$beta[nameY, nameX] : subscript out of bounds
1 Answers
Original Answer
The product-indicator method literally calculates products of (numerical values of) indicators. You can only do this with ordinal data by treating the (arbitrarily numbered) category labels as though they were really numbers. Here is a simulation study comparing that approach to LMS estimation while treating indicators as ordinal:
https://doi.org/10.1177/0013164419865017
Treating them as numeric may be the most expedient approach if there are several categories (so approximately continuous). Otherwise, you could use the parameter-moderation approach:
https://doi.org/10.1037/met0000501
Post-comment addition:
If only the outcome is an observed ordinal variable (e.g., binary like the OP's, or more categories like the reprex below), the probe2WayMC()
function still works:
library(semTools)
dat2wayMC <- indProd(dat2way, 1:3, 4:6)
## make an ordinal outcome from f3's indicators
dat2wayMC$DV <- cut(rowSums(dat2wayMC[paste0("x", 7:9)]),
breaks = 3, labels = FALSE)
table(dat2wayMC$DV)
mod <- "## measurement models for predictors
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
f12 =~ x1.x4 + x2.x5 + x3.x6
## mean centering makes correlations with interaction zero
f12 ~~ 0*f1 + 0*f2
## regress ordinal outcome
DV ~ f1 + f2 + f12
"
fit <- sem(mod, data = dat2wayMC, ordered = "DV")
summary(fit)
probe2WayMC(fit, nameX = c("f1", "f2", "f12"), nameY = "DV",
modVar = "f2", valProbe = c(-1, 0, 1))
If (as in the OP's case, described in a comment below this answer) the moderator is also binary, then product indicators are not necessary because a multigroup SEM allows for moderation by the group=
variable:
# not dat2wayMC (unnecessary)
dat2way <- data.frame(dat2way)
dat2way$D <- cut(rowSums(dat2way[paste0("x", 4:6)]),
breaks = 2, labels = FALSE)
dat2way$DV <- cut(rowSums(dat2way[paste0("x", 7:9)]),
breaks = 2, labels = FALSE)
table(moderator = dat2way$D,
outcome = dat2way$DV)
mod2 <- "
## measurement model for focal predictor
## with metric-invariance constraints
f1 =~ c(L1, L1)*x1 + c(L2, L2)*x2 + c(L3, L3)*x3
## threshold invariance for binary outcome
DV | c(th1, th1)*t1
## regress ordinal outcome on focal predictor
## with unique labels per group
DV ~ c(b1, b2)*f1
## slope difference across groups
## (moderating effect)
b2_vs_b1 := b2 - b1
"
fit2 <- sem(mod2, data = dat2way, ordered = "DV",
group = "D")
summary(fit2)
Note that the slopes are only (validly) comparable given invariance constraints on thresholds and loadings, so that the scales are linked across groups for the latent factor f1
and the latent response underlying DV
. The MG-SEM approach is also less restrictive because it allows (residual) variances to differ across groups, whereas a single-group approach (using product indicators) would assume homoskedasticity.
https://doi.org/10.1080/10705511.2020.1766357
https://doi.org/10.1007/978-3-319-77249-3_20 (tutorial with lavaan
examples)

- 780
- 4
- 7
-
Thank you so much Terrence! Maybe I wasn't precise enough. In our case, the final dependent variable is binary (0-1), which is affected directly by the latent variable and a dummy variable, and also by their interaction. In this case, the probe2way function doesn't work if we set the dependent variable ordered. Can you help us clarify why are we getting that error (Error in est$beta[nameY, nameX] : subscript out of bounds)? The reason why we don't treat the dependent variable continuously is that we got out-of-range predictions in the visualization of the interactions. – Ádám Stefkovics May 11 '23 at 09:15
-
I think that error must have been resolved in the development version: https://github.com/simsem/semTools/wiki See my updated response for example syntax and my suggestion. – Terrence May 11 '23 at 12:51
-
Terrence, this is great, thanks. We'll go for the second advice since our moderator is also binary. One more question. As I see it we cannot use emmeans if the DV is ordered. Can you explain how should we probe the difference between the slopes in the two groups? – Ádám Stefkovics May 15 '23 at 19:42
-
If there are only 2 groups, there is only 1 comparison to make. I showed how to calculate a difference between groups in the syntax example: `b2_vs_b1 := b2 - b1` – Terrence May 17 '23 at 07:37