m1 <- '
X =~ x1 + x2
Z =~ z1 + z2
Y =~ y1 + y2
Y ~ X + Z + X:Z
'
fit_pi <- modsem(m1, oneInt)
bootstrap_modsem(fit_pi, FUN = coef, R = 10L)
m1 <- '
X =~ x1 + x2
Z =~ z1 + z2
Y =~ y1 + y2
Y ~ X + Z + X:Z
'
if (FALSE) {
fit_lms <- modsem(m1, oneInt, method = "lms")
bootstrap_modsem(fit_lms, FUN = coef, R = 10L)
}
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 + INT:PBC
"
if (FALSE) {
boot <- bootstrap_modsem(model = modsem,
model.syntax = tpb, data = TPB,
method = "dblcent", rcs = TRUE,
rcs.scale.corrected = TRUE,
FUN = "coef")
coef <- apply(boot, MARGIN = 2, FUN = mean, na.rm = TRUE)
se <- apply(boot, MARGIN = 2, FUN = sd, na.rm = TRUE)
cat("Parameter Estimates:\n")
print(coef)
cat("Standard Errors: \n")
print(se)
}
Run the code above in your browser using DataLab