R/mdt_within_wide.R
mdt_within_wide.Rd
Given a data frame, a predictor (IV
), an outcome
(DV
), a mediator (M
), and a grouping variable (group
)
conducts a joint-significant test for within-participant mediation (see
Yzerbyt, Muller, Batailler, & Judd, 2018).
mdt_within_wide(data, DV_A, DV_B, M_A, M_B)
a data frame containing the variables in the model.
an unquoted numeric variable in the data frame which will be used as the dependent variable value for the "A" independent variable condition.
an unquoted numeric variable in the data frame which will be used as the dependent variable value for the "B" independent variable condition.
an unquoted numeric variable in the data frame which will be used as the mediatior variable value for the "A" independent variable condition.
an unquoted numeric variable in the data frame which will be used as the mediatior variable value for the "b" independent variable condition.
Returns an object of class "mediation_model
".
An object of class "mediation_model
" is a list containing at least
the components:
A character string containing the type of model that has been
conducted (e.g., "simple mediation"
).
A character string containing the approach that has been
used to conduct the mediation analysis (usually
"joint significance"
).
A named list of character strings describing the variables used in the model.
A named list containing information on each relevant path of the mediation model.
A boolean indicating whether an indirect effect index
has been computed or not. Defaults to FALSE
. See
add_index
to compute mediation index.
(Optional) An object of class
"indirect_index"
. Appears when one applies add_index
to an object of class "mediation_model"
.
A list of objects of class "lm"
. Contains every
model relevant to joint-significance testing.
The original data frame that has been passed through
data
argument.
With within-participant mediation analysis, one tests whether the effect of \(X\) on \(Y\) goes through a third variable \(M\). The specificity of within-participant mediation analysis lies in the repeated measures design it relies on. With such a design, each sampled unit (e.g., participant) is measured on the dependent variable \(Y\) and the mediator \(M\) in the two conditions of \(X\). The hypothesis behind this test is that \(X\) has an effect on \(M\) (\(a\)) which has an effect on \(Y\) (\(b\)), meaning that \(X\) has an indirect effect on \(Y\) through \(M\).
As with simple mediation, the total effect of \(X\) on \(Y\) can be conceptually described as follows:
$$c = c' + ab$$
with \(c\) the total effect of \(X\) on \(Y\), \(c'\) the direct of \(X\) on \(Y\), and \(ab\) the indirect effect of \(X\) on \(Y\) through \(M\) (see Models section).
To assess whether the indirect effect is different from the null, one has to assess the significance against the null for both \(a\) (the effect of \(X\) on \(M\)) and \(b\) (effect of \(M\) on \(Y\) controlling for the effect of \(X\)). Both \(a\) and \(b\) need to be simultaneously significant for an indirect effect to be claimed (Judd, Kenny, & McClelland, 2001; Montoya & Hayes, 2011).
To be consistent with other mdt_*
family
functions, mdt_within
takes a long-format data frame as data
argument. With this kind of format, each sampled unit has two rows, one for
the first within-participant condition and one for the second
within-participant condition. In addition, each row has one observation for
the outcome and one observation for the mediator (see
dohle_siegrist
for an example.
Because such formatting is not the most common among social scientists
interested in within-participant mediation, JSmediation contains the
mdt_within_wide
function which handles wide-formatted data
input (but is syntax-inconsistent with other mdt_*
family
functions).
Models underlying within-participant mediation use
difference scores as DV (see Models section). mdt_within_wide
uses
M_A
\(-\) M_B
and DV_A
\(-\) DV_B
in these
models.
For within-participant mediation, three models will be fitted:
\(Y_{2i} - Y_{1i} = c_{11}\)
\(M_{2i} - M_{1i} = a_{21}\)
\(Y_{2i} - Y_{1i} = c'_{31} + b_{32}(M_{2i} - M_{1i}) + d_{33}[0.5(M_{1i} + M_{2i}) - 0.5(\overline{M_{1} + M_{2}})]\)
with \(Y_{2i} - Y_{1i}\) the difference score between DV conditions for the outcome variable for the ith observation, \(M_{2i} - M_{1i}\) the difference score between DV conditions for the mediator variable for the ith observation, \(M_{1i} + M_{2i}\) the sum of mediator variables values for DV conditions for the ith observation, and \(\overline{M_{1} + M_{2}}\) the mean sum of mediator variables values for DV conditions across observations (see Montoya & Hayes, 2011).
Coefficients associated with \(a\), \(b\), \(c\), and \(c'\) paths are respectively \(a_{21}\), \(b_{32}\), \(c_{11}\), and \(c'_{31}\).
Judd, C. M., Kenny, D. A., & McClelland, G. H. (2001). Estimating and testing mediation and moderation in within-subject designs. Psychological Methods, 6(2), 115-134. doi: 10.1037//1082-989X.6.2.115
Montoya, A. K., & Hayes, A. F. (2017). Two-condition within-participant statistical mediation analysis: A path-analytic framework. Psychological Methods, 22(1), 6-27. doi: 10.1037/met0000086
Yzerbyt, V., Muller, D., Batailler, C., & Judd, C. M. (2018). New recommendations for testing indirect effects in mediational models: The need to report and test component paths. Journal of Personality and Social Psychology, 115(6), 929–943. doi: 10.1037/pspa0000132