- x
A character string specifying the focal predictor (x-axis variable).
- z
A character string specifying the moderator variable.
- y
A character string specifying the outcome (dependent) variable.
- xz
A character string specifying the interaction term (x:z
).
If NULL
, the term is created automatically as paste(x, z, sep = ":")
.
Some SEM backends may handle the interaction term differently (for instance, by
removing or modifying the colon), and this function attempts to reconcile that
internally.
- vals_x
A numeric vector of values at which to compute and plot the focal
predictor x
. The default is seq(-3, 3, .001)
, which provides a
relatively fine grid for smooth lines. If rescale=TRUE
, these values
are in standardized (mean-centered and scaled) units, and will be converted back
to the original metric in the internal computation of predicted means.
- vals_z
A numeric vector of values of the moderator z
at which to draw
separate regression lines. Each distinct value in vals_z
defines a separate
group (plotted with a different color). If rescale=TRUE
, these values
are also assumed to be in standardized units.
- model
An object of class modsem_pi
, modsem_da
,
modsem_mplus
, or possibly a lavaan
object. Must be a fitted
SEM model containing paths for y ~ x + z + x:z
.
- alpha_se
A numeric value in \([0, 1]\) specifying the transparency of
the confidence/prediction interval ribbon. Default is 0.15
.
- digits
An integer specifying the number of decimal places to which the
moderator values (z
) are rounded for labeling/grouping in the plot.
- ci_width
A numeric value in \((0,1)\) indicating the coverage of the
confidence (or prediction) interval. The default is 0.95
for a 95%
interval.
- ci_type
A character string specifying whether to compute
"confidence"
intervals (for the mean of the predicted values, default)
or "prediction"
intervals (which include residual variance).
- rescale
Logical. If TRUE
(default), vals_x
and vals_z
are interpreted as standardized units, which are mapped back to the raw scale
before computing predictions. If FALSE
, vals_x
and vals_z
are taken as raw-scale values directly.
- ...
Additional arguments passed on to simple_slopes
.