- x
Character. The name of the
predictor at the start of the path.
- y
Character. The name of the
outcome variable at the end of the
path.
- m
A vector of the variable
names of the mediator(s). The path
goes from the first mediator
successively to the last mediator. If
NULL
, the default, the path goes
from x
to y
.
- w
Character. The name of the
moderator.
- fit
The fit object. Can be a
lavaan::lavaan-class
object, a list
of lm()
outputs, or an object
created by lm2list()
.
It can also be
a lavaan.mi
object
returned by
semTools::runMI()
or
its wrapper, such as semTools::sem.mi()
.
- boot_ci
Logical. Whether
bootstrap confidence interval will be
formed. Default is FALSE
.
- level
The level of confidence
for the bootstrap confidence
interval. Default is .95.
- boot_out
If boot_ci
is
TRUE
, users can supply pregenerated
bootstrap estimates. This can be the
output of do_boot()
. For
indirect_effect()
and
cond_indirect_effects()
, this can
be the output of a previous call to
cond_indirect_effects()
,
indirect_effect()
, or
cond_indirect()
with bootstrap
confidence intervals requested. These
stored estimates will be reused such
that there is no need to do
bootstrapping again. If not supplied,
the function will try to generate
them from fit
.
- R
Integer. If boot_ci
is
TRUE
, boot_out
is NULL
, and
bootstrap standard errors not
requested if fit
is a
lavaan-class
object, this function
will do bootstrapping on fit
. R
is the number of bootstrap samples.
Default is 100. For Monte Carlo
simulation, this is the number
of replications.
- seed
If bootstrapping
or Monte Carlo simulation is
conducted, this is the seed for the
bootstrapping or simulation.
Default is NULL
and
seed is not set.
- progress
Logical. Display
bootstrapping progress or not.
Default is TRUE
.
- mc_ci
Logical. Whether
Monte Carlo confidence interval will be
formed. Default is FALSE
.
- mc_out
If mc_ci
is
TRUE
, users can supply pregenerated
Monte Carlo estimates. This can be the
output of do_mc()
. For
indirect_effect()
and
cond_indirect_effects()
, this can
be the output of a previous call to
cond_indirect_effects()
,
indirect_effect()
, or
cond_indirect()
with Monte Carlo
confidence intervals requested. These
stored estimates will be reused such
that there is no need to do
Monte Carlo simulation again. If not
supplied,
the function will try to generate
them from fit
.
- ci_type
The type of
confidence intervals to be formed.
Can be either "boot"
(bootstrapping)
or "mc"
(Monte Carlo). If not
supplied or is NULL
, will check
other arguments
(e.g, boot_ci
and mc_ci
). If
supplied, will override boot_ci
and mc_ci
.
- ci_out
If ci_type
is supplied,
this is the corresponding argument.
If ci_type
is "boot"
, this
argument will be used as boot_out
.
If ci_type
is "mc"
, this
argument will be used as mc_out
.
- boot_type
If bootstrap
confidence interval is to be formed,
the type of bootstrap confidence
interval. The supported types
are "perc"
(percentile bootstrap
confidence interval, the default and
recommended type) and "bc"
(bias-corrected, or BC, bootstrap
confidence interval).
- ...
Arguments to be passed to
cond_indirect_effects()
- z
Character. The name of the
second moderator, for computing the
index of moderated moderated
mediation.