Latent Interaction (and Moderation) Analysis in Structural Equation Models (SEM)

Estimation of interaction (i.e., moderation) effects between latent variables in structural equation models (SEM). The supported methods are: The constrained approach (Algina & Moulder, 2001). The unconstrained approach (Marsh et al., 2004). The residual centering approach (Little et al., 2006). The double centering approach (Lin et al., 2010). The latent moderated structural equations (LMS) approach (Klein & Moosbrugger, 2000). The quasi-maximum likelihood (QML) approach (Klein & Muthén, 2007) The constrained- unconstrained, residual- and double centering- approaches are estimated via 'lavaan' (Rosseel, 2012), whilst the LMS- and QML- approaches are estimated via 'modsem' it self. Alternatively model can be estimated via 'Mplus' (Muthén & Muthén, 1998-2017). References: Algina, J., & Moulder, B. C. (2001). . "A note on estimating the Jöreskog-Yang model for latent variable interaction using 'LISREL' 8.3." Klein, A., & Moosbrugger, H. (2000). . "Maximum likelihood estimation of latent interaction effects with the LMS method." Klein, A. G., & Muthén, B. O. (2007). . "Quasi-maximum likelihood estimation of structural equation models with multiple interaction and quadratic effects." Lin, G. C., Wen, Z., Marsh, H. W., & Lin, H. S. (2010). . "Structural equation models of latent interactions: Clarification of orthogonalizing and double-mean-centering strategies." Little, T. D., Bovaird, J. A., & Widaman, K. F. (2006). . "On the merits of orthogonalizing powered and product terms: Implications for modeling interactions among latent variables." Marsh, H. W., Wen, Z., & Hau, K. T. (2004). . "Structural equation models of latent interactions: evaluation of alternative estimation strategies and indicator construction." Muthén, L.K. and Muthén, B.O. (1998-2017). "'Mplus' User’s Guide. Eighth Edition." < https://www.statmodel.com/>. Rosseel Y (2012). . "'lavaan': An R Package for Structural Equation Modeling."


modsem Logo

R-CMD-check Tests CRAN PKGDOWN-Build GitHub Clones

modsem is an R-package for estimating interaction (i.e., moderation) effects between latent variables in structural equation models (SEMs). See https://www.modsem.org for a tutorial.

Installation

modsem is available on CRAN and GitHub, and can be installed as follows:

# From CRAN 
install.packages("modsem")

# Latest version from GitHub
install.packages("remotes")
remotes::install_github("kss2k/modsem", build_vignettes = TRUE)

Note: The package needs to be compiled from source on macOS (if installing via GitHub) and Linux. If you have issues installing the package on macOS, you might need to install the gfortran compiler. A C++ compiler is also required, but should be installed by default on most systems. See the R for macOs page for more information.

If you're using Windows, consider installing OpenBLAS in R for Windows for better perfmance. If you're using a Linux distribution, consider installing the ropenblas package

Methods/Approaches

There are a number of approaches for estimating interaction effects in SEM. In modsem(), the method = "method" argument allows you to choose which to use. Different approaches can be categorized into two groups: Product Indicator (PI) and Distribution Analytic (DA) approaches.

Product Indicator (PI) Approaches:

  • "ca" = constrained approach (Algina & Moulder, 2001)
    • Note that constraints can become quite complicated for complex models, particularly when there is an interaction including enodgenous variables. The method can therefore be quite slow.
  • "uca" = unconstrained approach (Marsh, 2004)
  • "rca" = residual centering approach (Little et al., 2006)
  • "dblcent" = double centering approach (Marsh., 2013)
    • default
  • "pind" = basic product indicator approach (not recommended)

Distribution Analytic (DA) Approaches

  • "lms" = The Latent Moderated Structural equations (LMS) approach, see the vignette
  • "qml" = The Quasi Maximum Likelihood (QML) approach, see the vignette
  • "mplus" = Mplus
    • estimates model through Mplus, if it is installed

Examples

Elementary Interaction Model (Kenny & Judd, 1984; Jaccard & Wan, 1995)

library(modsem)

m1 <- '
  # Outer Model
  X =~ x1 + x2 + x3
  Y =~ y1 + y2 + y3
  Z =~ z1 + z2 + z3
  
  # Inner model
  Y ~ X + Z + X:Z 
'

# Double centering approach
est1_dca <- modsem(m1, oneInt)
summary(est1_dca)

# Constrained approach
est1_ca <- modsem(m1, oneInt, method = "ca")
summary(est1_ca)

# QML approach 
est1_qml <- modsem(m1, oneInt, method = "qml")
summary(est1_qml, standardized = TRUE) 

# LMS approach 
est1_lms <- modsem(m1, oneInt, method = "lms") 
summary(est1_lms)

Theory Of Planned Behavior

tpb <- "
# Outer Model (Based on Hagger et al., 2007)
  ATT =~ att1 + att2 + att3 + att4 + att5
  SN =~ sn1 + sn2
  PBC =~ pbc1 + pbc2 + pbc3
  INT =~ int1 + int2 + int3
  BEH =~ b1 + b2

# Inner Model (Based on Steinmetz et al., 2011)
  INT ~ ATT + SN + PBC
  BEH ~ INT + PBC
  BEH ~ PBC:INT
"

# double centering approach
est_tpb_dca <- modsem(tpb, data = TPB, method = "dblcent")
summary(est_tpb_dca)

# Constrained approach using Wrigths path tracing rules for generating
# the appropriate constraints
est_tpb_ca <- modsem(tpb, data = TPB, method = "ca") 
summary(est_tpb_ca)

# LMS approach 
est_tpb_lms <- modsem(tpb, data = TPB, method = "lms")
summary(est_tpb_lms, standardized = TRUE) 

# QML approach 
est_tpb_qml <- modsem(tpb, data = TPB, method = "qml") 
summary(est_tpb_qml, standardized = TRUE)

Interactions between two observed variables

est2 <- modsem('y1 ~ x1 + z1 + x1:z1', data = oneInt, method = "dblcent")
summary(est2)

Interaction between an obsereved and a latent variable

m3 <- '
  # Outer Model
  X =~ x1 + x2 + x3
  Y =~ y1 + y2 + y3
  
  # Inner model
  Y ~ X + z1 + X:z1
'

est3 <- modsem(m3, oneInt, method = "dblcent", 
               res.cov.method = "none") # res.cov.method = "simple" will lead
                                        # to an unidentifiable model. Instead we
                                        # constrain them to zero
summary(est3)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("modsem")

1.0.23 by Kjell Solem Slupphaug, 5 days ago


https://modsem.org, https://github.com/kss2k/modsem


Browse source code at https://github.com/cran/modsem


Authors: Kjell Solem Slupphaug [aut, cre] (ORCID: , Mehmet Mehmetoglu [ctb] (ORCID: , Matthias Mittner [ctb]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports Rcpp, purrr, stringr, lavaan, rlang, nlme, dplyr, mvnfast, stats, fastGHQuad, mvtnorm, ggplot2, parallel, plotly, Deriv, MASS, Amelia, grDevices, cli, RhpcBLASctl, memoise

Suggests knitr, rmarkdown, ggpubr, RColorBrewer, MplusAutomation

Linking to Rcpp, RcppArmadillo


Imported by plssem.

Suggested by rmedsem.


See at CRAN