LMS and QML approaches

library(modsem)

The Latent Moderated Structural Equations (LMS) and the Quasi Maximum Likelihood (QML) approaches.

The LMS and QML approaches are implemented in modsem. Currently the QML approach is only implented for simpler models with a single endogenous (i.e., dependent) variable. The LMS approach however works on most models, except for models where there is an interaction between two endogenous (i.e., dependent) variables. Both approaches (particularily the LMS approach) are quite computationally intensive, and are thus partly implemented in C++ (using Rcpp and RcppArmadillo). Additionally starting parameters are estimated using the double centering approach (and the means of the observed variables) are used to generate good starting parameters for faster convergence. If you want to see the progress of the estimation process you can use ´verbose = TRUE´.

A Simple Example

Here you can see an example of the LMS approach for a simple model. By default the summary function calculates fit measures compared to a null model (i.e., the same model without an interaction term).

library(modsem)
m1 <- '
# Outer Model
  X =~ x1
  X =~ x2 + x3
  Z =~ z1 + z2 + z3
  Y =~ y1 + y2 + y3

# Inner model
  Y ~ X + Z
  Y ~ X:Z
'

lms1 <- modsem(m1, oneInt, method = "lms")
summary(lms1)

Here you can see the same example using the QML approach.

qml1 <- modsem(m1, oneInt, method = "qml")
summary(qml1)

A more complicated example

Here you can see an example of a more complicated example using the model from the theory of planned behaviour (TPB), where there are two endogenous variables, where there is an interaction between an endogenous and exogenous variable. (note this does not work with the QML approach). For more complicated models, it is recommended that you increase the number of nodes used for numerical integration. By default the number of nodes is set to 16, and can be increased using the nodes argument.

# ATT = Attitude, 
# PBC = Perceived Behavioural Control 
# INT = Intention 
# SN = Subjective Norms
# BEH = Behaviour
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 ~ INT:PBC  
'

lms2 <- modsem(tpb, TPB, method = "lms", nodes = 20)
summary(lms2)