mdt_within {JSmediation} | R Documentation |
Joint-significance test for within-participant mediation
Description
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).
Usage
mdt_within(data, IV, DV, M, grouping, default_coding = TRUE)
Arguments
data |
a data frame containing the variables in the model. |
IV |
an unquoted variable in the data frame which will be used as the independent variable. |
DV |
an unquoted variable in the data frame which will be used as the dependent variable. |
M |
an unquoted variable in the data frame which will be used as the mediator. |
grouping |
an unquoted variable in the data frame which will be used as the grouping variable. |
default_coding |
should the variable coding be the default? Defaults to
|
Details
With within-participant mediation analysis, one tests whether the
effect of on
goes through a third variable
. 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
and the mediator
in the two conditions of
. The hypothesis behind this test
is that
has an effect on
(
) which has an effect on
(
), meaning that
has an indirect effect on
through
.
As with simple mediation, the total effect of on
can be
conceptually described as follows:
with the total effect of
on
,
the direct of
on
, and
the indirect effect of
on
through
(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 (the effect of
on
) and
(effect of
on
controlling
for the effect of
). Both
and
need to be
simultaneously significant for an indirect effect to be claimed (Judd,
Kenny, & McClelland, 2001; Montoya & Hayes, 2011).
Value
Returns an object of class "mediation_model
".
An object of class "mediation_model
" is a list containing at least
the components:
type |
A character string containing the type of model that has been
conducted (e.g., |
method |
A character string containing the approach that has been
used to conduct the mediation analysis (usually
|
params |
A named list of character strings describing the variables used in the model. |
paths |
A named list containing information on each relevant path of the mediation model. |
indirect_index |
A boolean indicating whether an indirect effect index
has been computed or not. Defaults to |
indirect_index_infos |
(Optional) An object of class
|
js_models |
A list of objects of class |
data |
The original data frame that has been passed through
|
Models
For within-participant mediation, three models will be fitted:
with the difference score between DV
conditions for the outcome variable for the ith observation,
the difference score between DV conditions
for the mediator variable for the ith observation,
the sum of mediator variables values for DV conditions
for the ith observation, and
the mean sum of mediator variables values for DV conditions across
observations (see Montoya & Hayes, 2011).
Coefficients associated with ,
,
, and
paths
are respectively
,
,
,
and
.
Data formatting
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).
Variable coding
Models underlying within-participant mediation use
difference scores as DV (see Models section). Because the function input
does not allow the user to specify how the difference scores should be
computed, mdt_within
has a default coding.
mdt_within
's default behavior is to compute the difference score so
the total effect (the effect of on
) will be positive and
compute the other difference scores accordingly. That is, if
mdt_within
has to use (instead of
) so that
is positive, it will use
(instead of
in the other models.
User can choose to have a negative total effect by using the
default_coding
argument.
Note that DV
and M
have to be numeric.
References
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
See Also
Other mediation models:
mdt_moderated()
,
mdt_simple()