tests/testthat/test_mplus.R

devtools::load_all()
m1 <- '
# Outer Model
X =~ x1
X =~x2
Z =~ z1 + z2
Y =~ y1 + y2 


# Inner model
Y ~ X + Z
Y ~ X:Z
'
run <- tryCatch({
    MplusAutomation::detectMplus()
    TRUE
  },
  error = function(e) FALSE
)
if (run) {
  mplus <- modsem(m1, oneInt, method = "mplus")
  print(summary(mplus))
  plot_interaction(x = "X", z = "Z", y = "Y", xz = "X:Z", vals_z = c(-0.5, 0.5), model = mplus)
} 

Try the modsem package in your browser

Any scripts or data that you put into this service are public.

modsem documentation built on April 3, 2025, 7:51 p.m.