View source: R/compute_indirect_effect_for.R
compute_indirect_effect_for | R Documentation |
When computing a moderated mediation, one assesses whether an indirect
effect changes according a moderator value (Muller et al., 2005).
mdt_moderated
makes it easy to assess moderated mediation, but it does
not allow accessing the indirect effect for a specific moderator values.
compute_indirect_effect_for
fills this gap.
compute_indirect_effect_for( mediation_model, Mod = 0, times = 5000, level = 0.05 )
mediation_model |
A moderated mediation model fitted with
|
Mod |
The moderator value for which to compute the indirect effect. Must
be a numeric value, defaults to |
times |
Number of simulations to use to compute the Monte Carlo indirect
effect confidence interval. Must be numeric, defaults to |
level |
Alpha threshold to use for the indirect effect's confidence
interval. Defaults to |
The approach used by compute_indirect_effect_for
is similar to the
approach used for simple slope analyses. Specifically, it will fit a new
moderated mediation model, but with a data set with a different variable
coding. Behind the scenes, compute_indirect_effect_for
adjusts the
moderator variable coding, so that the value we want to compute the
indirect effect for is now 0
.
Once done, a new moderated mediation model is applied using the new data set. Because of the new coding, and because of how one interprets coefficients in a linear regression, a * b is now the indirect effect we wanted to compute (see the Models section).
Thanks to the returned values of a and bb (b_51
and b_64, see the Models section), it is now easy to compute
a * b. compute_indirect_effect_for
uses the same
approach than the add_index
function. A Monte Carlo simulation is used
to compute the indirect effect index (MacKinnon et al., 2004).
In a moderated mediation model, three models are used.
compute_indirect_effect_for
uses the same model specification as
mdt_moderated
:
Yi = b_41 + b41*Xi + b42*Moi + + b43*XMoi
Mi = b_50 + b_51*Xi + b_52 Moi + b53 XMoi
Yi = b_60 + b61*Xi + b_62*Moi + b63 XMoi + b64 Mei + b65 MeMoi
with Yi, the outcome value for the ith observation, Xi, the predictor value for the ith observation, Xi, the moderator value for the ith observation, and Mi, the mediator value for the ith observation.
Coefficients associated with a, a * Mod, b, b * Mod, c, c * Mod, c', and c' * Mod, paths are respectively b_51, b_53, b_64, b_65, b_41, b_43, b_61, and c63 (see Muller et al., 2005).
MacKinnon, D. P., Lockwood, C. M., & Williams, J. (2004). Confidence Limits for the Indirect Effect: Distribution of the Product and Resampling Methods. Multivariate Behavioral Research, 39(1), 99-128. doi: 10.1207/s15327906mbr3901_4
Muller, D., Judd, C. M., & Yzerbyt, V. Y. (2005). When moderation is mediated and mediation is moderated. Journal of Personality and Social Psychology, 89(6), 852-863. doi: 10.1037/0022-3514.89.6.852
# compute an indirect effect index for a specific value in a moderated # mediation. data(ho_et_al) ho_et_al$condition_c <- build_contrast(ho_et_al$condition, "Low discrimination", "High discrimination") ho_et_al <- standardize_variable(ho_et_al, c(linkedfate, sdo)) moderated_mediation_model <- mdt_moderated(data = ho_et_al, DV = hypodescent, IV = condition_c, M = linkedfate, Mod = sdo) compute_indirect_effect_for(moderated_mediation_model, Mod = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.