| index_of_mome | R Documentation |
It computes the index of moderated mediation and the index of moderated moderated mediation proposed by Hayes (2015, 2018).
index_of_mome(
x,
y,
m = NULL,
w = NULL,
fit = NULL,
boot_ci = FALSE,
level = 0.95,
boot_out = NULL,
R = 100,
seed = NULL,
progress = TRUE,
mc_ci = FALSE,
mc_out = NULL,
ci_type = NULL,
ci_out = NULL,
boot_type = c("perc", "bc"),
skip_indicators = TRUE,
increase_from = 0,
increase_to = 1,
w_unit = c("raw", "sd"),
...
)
index_of_momome(
x,
y,
m = NULL,
w = NULL,
z = NULL,
fit = NULL,
boot_ci = FALSE,
level = 0.95,
boot_out = NULL,
R = 100,
seed = NULL,
progress = TRUE,
mc_ci = FALSE,
mc_out = NULL,
ci_type = NULL,
ci_out = NULL,
boot_type = c("perc", "bc"),
skip_indicators = TRUE,
w_increase_from = 0,
w_increase_to = 1,
z_increase_from = 0,
z_increase_to = 1,
w_unit = c("raw", "sd"),
z_unit = c("raw", "sd"),
...
)
z_index_of_momome(
x,
y,
m = NULL,
w = NULL,
z = NULL,
fit = NULL,
boot_ci = FALSE,
level = 0.95,
boot_out = NULL,
R = 100,
seed = NULL,
progress = TRUE,
mc_ci = FALSE,
mc_out = NULL,
ci_type = NULL,
ci_out = NULL,
boot_type = c("perc", "bc"),
skip_indicators = TRUE,
w_increase_from = 0,
w_increase_to = 1,
z_increase_from = 0,
z_increase_to = 1,
w_unit = c("raw", "sd"),
z_unit = c("raw", "sd"),
...
)
z_index_of_mome(
x,
y,
m = NULL,
w = NULL,
fit = NULL,
boot_ci = FALSE,
level = 0.95,
boot_out = NULL,
R = 100,
seed = NULL,
progress = TRUE,
mc_ci = FALSE,
mc_out = NULL,
ci_type = NULL,
ci_out = NULL,
boot_type = c("perc", "bc"),
skip_indicators = TRUE,
increase_from = 0,
increase_to = 1,
w_unit = c("raw", "sd"),
...
)
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
|
w |
Character. The name of the moderator. |
fit |
The fit object. Can be a
|
boot_ci |
Logical. Whether
bootstrap confidence interval will be
formed. Default is |
level |
The level of confidence for the bootstrap confidence interval. Default is .95. |
boot_out |
If |
R |
Integer. If |
seed |
If bootstrapping
or Monte Carlo simulation is
conducted, this is the seed for the
bootstrapping or simulation.
Default is |
progress |
Logical. Display
bootstrapping progress or not.
Default is |
mc_ci |
Logical. Whether
Monte Carlo confidence interval will be
formed. Default is |
mc_out |
If |
ci_type |
The type of
confidence intervals to be formed.
Can be either |
ci_out |
If |
boot_type |
If bootstrap
confidence interval is to be formed,
the type of bootstrap confidence
interval. The supported types
are |
skip_indicators |
Whether
observed indicators are skipped from
the search for product terms. Default
is |
increase_from, increase_to |
The change in the value of the moderator on which the index is to be computed. The default is a one-unit increase (e.g., from 0 to 1), as proposed by Hayes (2015). |
w_unit |
The unit used
by |
... |
Arguments to be passed to
|
z |
Character. The name of the second moderator, for computing the index of moderated moderated mediation. |
w_increase_from, w_increase_to |
The
change in the value of the moderator |
z_increase_from, z_increase_to |
The
change in the value of the moderator |
z_unit |
The unit used to
by |
The function
index_of_mome() computes the index
of moderated mediation proposed by
Hayes (2015). It supports any path in
a model with one (and only one)
component path moderated. For
example, x->m1->m2->y with x->m1
moderated by w. It measures the
change in indirect effect when the
moderator increases by one unit.
The function index_of_momome()
computes the index of moderated
moderated mediation proposed by
Hayes (2018). It supports any path in
a model, with two component paths
moderated, each by one moderator. For
example, x->m1->m2->y with x->m1
moderated by w and m2->y
moderated by z. It measures the
change in the index of moderated
mediation of one moderator when the
other moderator increases by one
unit.
It returns a
cond_indirect_diff-class object.
This class has a print method
(print.cond_indirect_diff()), a
coef method for extracting the
index (coef.cond_indirect_diff()),
and a confint method for extracting
the confidence interval if
available
(confint.cond_indirect_diff()).
index_of_mome(): Compute the
index of moderated mediation.
index_of_momome(): Compute the
index of moderated moderated
mediation.
z_index_of_momome(): Compute the
z index of moderated moderated
mediation, based on the idea proposed
by Cheung and Cheung (2024). A wrapper
of index_of_momome() with
w_unit = "sd", z_unit = "sd",
w_increase_from = 0,
w_increase_to = 1.
z_increase_from = 0, and
z_increase_to = 1.
z_index_of_mome(): Compute the
z index of moderated mediation
proposed by Cheung and Cheung (2024).
A wrapper of index_of_mome() with
w_unit set to "sd",
increase_from set to 0,
and increase_to set to 1.
Cheung, S. F., & Cheung, S.-H. (2024). manymome: An R package for computing the indirect effects, conditional effects, and conditional indirect effects, standardized or unstandardized, and their bootstrap confidence intervals, in many (though not all) models. Behavior Research Methods, 56(5), 4862-4882. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3758/s13428-023-02224-z")}
Hayes, A. F. (2015). An index and test of linear moderated mediation. Multivariate Behavioral Research, 50(1), 1-22. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00273171.2014.962683")}
Hayes, A. F. (2018). Partial, conditional, and moderated moderated mediation: Quantification, inference, and interpretation. Communication Monographs, 85(1), 4-40. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/03637751.2017.1352100")}
cond_indirect_effects()
library(lavaan)
dat <- modmed_x1m3w4y1
dat$xw1 <- dat$x * dat$w1
mod <-
"
m1 ~ a * x + f * w1 + d * xw1
y ~ b * m1 + cp * x
ind_mome := d * b
"
fit <- sem(mod, dat,
meanstructure = TRUE, fixed.x = FALSE,
se = "none", baseline = FALSE)
est <- parameterEstimates(fit)
# R should be at least 2000 or even 5000 in real research.
# parallel is set to TRUE by default.
# Therefore, in research, the argument parallel can be omitted.
out_mome <- index_of_mome(x = "x", y = "y", m = "m1", w = "w1",
fit = fit,
boot_ci = TRUE,
R = 40,
seed = 2345,
parallel = FALSE,
progress = FALSE)
out_mome
coef(out_mome)
# From lavaan
print(est[19, ], nd = 8)
confint(out_mome)
library(lavaan)
dat <- modmed_x1m3w4y1
dat$xw1 <- dat$x * dat$w1
dat$m1w4 <- dat$m1 * dat$w4
mod <-
"
m1 ~ a * x + f1 * w1 + d1 * xw1
y ~ b * m1 + f4 * w4 + d4 * m1w4 + cp * x
ind_momome := d1 * d4
"
fit <- sem(mod, dat,
meanstructure = TRUE, fixed.x = FALSE,
se = "none", baseline = FALSE)
est <- parameterEstimates(fit)
# See the example of index_of_mome on how to request
# bootstrap confidence interval.
out_momome <- index_of_momome(x = "x", y = "y", m = "m1",
w = "w1", z = "w4",
fit = fit)
out_momome
coef(out_momome)
print(est[32, ], nd = 8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.