| modsem_mplus | R Documentation |
MplusEstimation latent interactions through Mplus
modsem_mplus(
model.syntax,
data,
estimator = "ml",
cluster = NULL,
type = NULL,
algorithm = NULL,
processors = 2,
integration = 15,
analysis.options = NULL,
rcs = FALSE,
rcs.choose = NULL,
rcs.scale.corrected = TRUE,
output.std = TRUE,
categorical = NULL,
within = NULL,
between = NULL,
cleanup = FALSE,
...
)
model.syntax |
lavaan/modsem syntax. Multilevel models can be specified
using |
data |
dataset |
estimator |
estimator argument passed to |
cluster |
cluster argument passed to |
type |
type argument passed to |
algorithm |
algorithm argument passed to |
processors |
processors argument passed to |
integration |
integration argument passed to |
analysis.options |
Additional options passed to the |
rcs |
Should latent variable indicators be replaced with reliability-corrected
single item indicators instead? See |
rcs.choose |
Which latent variables should get their indicators replaced with
reliability-corrected single items? It is passed to |
rcs.scale.corrected |
Should reliability-corrected items be scale-corrected? If |
output.std |
Should |
categorical |
categorical argument passed to |
within |
Variables which should be declared as |
between |
Variables which should be declared as |
cleanup |
Should the |
... |
arguments passed to other functions |
Interaction terms (e.g., X:Z) involving at least one latent variable are
specified using XWITH, whilst interaction terms between observed variables are
computed as product terms in the DEFINE command of Mplus.
If estimator = "bayes" the parameter table contains the posterior means
(est), posterior standard deviations (std.error), the one-tailed
p-values reported by Mplus (p.value), and the 95% credible
intervals (ci.lower and ci.upper). z.value is NA.
The number of iterations, chains etc. can be set using analysis.options.
In multilevel models random slopes are specified using the rv() modifier
in the within level model (e.g., Y ~ rv("s")*X), which is translated to
s | Y ON X; in Mplus. The random slope (s) is a latent variable
at the between level, where it can be used like any other latent variable. Note that
the fixed effect of a random slope is the mean (or intercept) of the random slope at
the between level.
modsem_mplus object
# Theory Of Planned Behavior
m1 <- '
# Outer Model
X =~ x1 + x2
Z =~ z1 + z2
Y =~ y1 + y2
# Inner model
Y ~ X + Z + X:Z
'
## Not run:
# Check if Mplus is installed
run <- tryCatch({MplusAutomation::detectMplus(); TRUE},
error = \(e) FALSE)
if (run) {
est_mplus <- modsem_mplus(m1, data = oneInt)
summary(est_mplus)
}
# Multilevel model with a random slope, and a (within level) interaction
m2 <- '
level: 1
fw =~ y1 + y2 + y3
fw ~ rv("s")*x1 + x2 + x3 + x2:x3
level: 2
fb =~ y1 + y2 + y3
fb + s ~ w1 + w2
'
if (run) {
est_mplus_ml <- modsem_mplus(m2, data = lavaan::Demo.twolevel, cluster = "cluster")
summary(est_mplus_ml)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.