EVAL_DEFAULT <- FALSE knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = EVAL_DEFAULT )
library(modsem)
This vignette demonstrates how to evaluate and compare model fit for latent interaction models estimated via
using the modsem
package (v≥1.0.8). Because standard Chi-square statistics are not available under LMS/QML, we assess fit by:
If the baseline model shows acceptable fit and adding the latent interaction significantly improves fit, the interaction model can also be deemed well-fitting.
We define a model with three latent variables (X
, Y
, Z
) and their interaction (X:Z
):
m1 <- " # Outer (measurement) model X =~ x1 + x2 + x3 Y =~ y1 + y2 + y3 Z =~ z1 + z2 + z3 # Inner (structural) model Y ~ X + Z + X:Z " # Estimate the full (H1) model via LMS est_h1 <- modsem(m1, oneInt, method = "lms") # Estimate the baseline (H0) model without interaction est_h0 <- estimate_h0(est_h1, calc.se = FALSE) # std.errors are not needed
To get fit measures for the baseline model you can use the fit_modsem_da()
function.
fit_modsem_da(est_h0)
It can also be used to get fit measures for the full model, but should be pared with
chisq = FALSE
to avoid the Chi-square test. If it is set to TRUE
it will
calculate the Chi-square test while ignoring the interaction terms in the model.
fit_modsem_da(est_h1, chisq = FALSE)
Compare H0 vs. H1 using a log-likelihood ratio test:
compare_fit(est_h1 = est_h1, est_h0 = est_h0)
A significant p-value indicates the latent interaction term significantly improves model fit.
For convenience, you can also use the modsem_inspect()
function with
what = "fit"
to get fit indices for both models, and comparative fit in one go.
modsem_inspect(est_h1, what = "fit")
Klein, A., & Moosbrugger, H. (2000). <doi:10.1007/BF02296338>. "Maximum likelihood estimation of latent interaction effects with the LMS method." Klein, A. G., & Muthén, B. O. (2007). <doi:10.1080/00273170701710205>. "Quasi-maximum likelihood estimation of structural equation models with multiple interaction and quadratic effects."
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.