|
Hi there, thank you for this great package! I have a question regarding moderation involving an observed binary variable (0/1) and a latent variable. Is method = "lms" supported for latent × observed (binary) interactions in the current implementation? I would be grateful for any advice on how to handle this within the package. Kind regards, |
Replies: 1 comment 8 replies
|
Hi, In general, the LMS approach is only implemented for models with all continuous data. There are available options for handling categorical binary variables, treating them as functions of latent response variables, but this doesn't always make sense for exogenous/independent variables. When we have an interaction between a latent variable and a binary categorical variable, it is often more practical to measure the interaction effect via a (linear) multigroup model. Consider this hypothetical model, where we have an interaction between library(lavaan)
library(modsem)
# here we just create some toy data from the oneInt dataset
data <- oneInt
data$sex <- as.integer(oneInt$z1 > mean(oneInt$z1))
model <- '
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Y ~ c(x_male, x_female) * X
interaction := x_female - x_male
'
fit <- sem(model, data, group = "sex")
summary(fit)
#> ...
#> Defined Parameters:
#> Estimate Std.Err z-value P(>|z|)
#> interaction 1.124 0.060 18.753 0.000Alternatively you could use it like a normal dummy variable in a regression. This does of course violate the distributional assumptions of the different estimators in dummy_model <- '
X =~ x1 + x2 + x3
Y =~ y1 + y2 + y3
Y ~ X + sex + X:sex
'
fit_dummy_lms <- modsem(dummy_model, data, method = "lms", robust.se = TRUE)
summary(fit_dummy_lms)
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.146 0.043 3.368 0.001
#> sex 0.896 0.059 15.118 0.000
#> X:sex 1.122 0.066 17.134 0.000
fit_dummy_qml <- modsem(dummy_model, data, method = "qml", robust.se = TRUE)
summary(fit_dummy_qml)
#> Regressions:
#> Estimate Std.Error z.value P(>|z|)
#> Y ~
#> X 0.145 0.043 3.357 0.001
#> sex 0.896 0.059 15.106 0.000
#> X:sex 1.123 0.066 17.143 0.000 |
Hi,
In general, the LMS approach is only implemented for models with all continuous data. There are available options for handling categorical binary variables, treating them as functions of latent response variables, but this doesn't always make sense for exogenous/independent variables.
When we have an interaction between a latent variable and a binary categorical variable, it is often more practical to measure the interaction effect via a (linear) multigroup model. Consider this hypothetical model, where we have an interaction between
sexandXonY