library(modsem)
# For more examples, check README and/or GitHub.
# One interaction
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 <- modsem(m1, oneInt)
summary(est1)
if (FALSE) {
# The Constrained Approach
est1_ca <- modsem(m1, oneInt, method = "ca")
summary(est1_ca)
# LMS approach
est1_lms <- modsem(m1, oneInt, method = "lms")
summary(est1_lms)
# QML approach
est1_qml <- modsem(m1, oneInt, method = "qml")
summary(est1_qml)
}
# 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 ~ INT:PBC
'
# Double centering approach
est_tpb <- modsem(tpb, data = TPB)
summary(est_tpb)
if (FALSE) {
# The Constrained Approach
est_tpb_ca <- modsem(tpb, data = TPB, method = "ca")
summary(est_tpb_ca)
# LMS approach
est_tpb_lms <- modsem(tpb, data = TPB, method = "lms", nodes = 32)
summary(est_tpb_lms)
# QML approach
est_tpb_qml <- modsem(tpb, data = TPB, method = "qml")
summary(est_tpb_qml)
}
Run the code above in your browser using DataLab