Given a data frame, a predictor (IV), an outcome (DV), and a mediator (M), conducts a joint-significant test for simple mediation (see Yzerbyt, Muller, Batailler, & Judd, 2018).

mdt_simple(data, IV, DV, M)



A data frame containing the variables to be used in the model.


An unquoted numeric variable in the data frame which will be used as independent variable.


An unquoted numeric variable in the data frame which will be used as dependent variable.


An unquoted numeric variable in the data frame which will be used as mediator.


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 simple mediation analysis, one is interested in finding if the effect of \(X\) on \(Y\) goes through a third variable \(M\). The hypothesis behind this test is that \(X\) has an effect on \(M\) (\(a\)) that has an effect on \(Y\) (\(b\)), meaning that \(X\) has an indirect effect on \(Y\) through \(M\).

The total effect of \(X\) on \(Y\) can be 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 (Cohen & Cohen, 1983; Yzerbyt, Muller, Batailler, & Judd, 2018).


In a simple mediation model, three models will be fitted:

  • \(Y_i = b_{10} + \mathbf{c_{11}} X_i\)

  • \(M_i = b_{20} + \mathbf{a_{21}} X_i\)

  • \(Y_i = b_{30} + \mathbf{c'_{31}} X_i + \mathbf{b_{32}} M_i\)

with \(Y_i\), the outcome value for the ith observation, \(X_i\), the predictor value for the ith observation, and \(M_i\), the mediator value for the ith observation (Cohen & Cohen, 1983; Yzerbyt, Muller, Batailler, & Judd, 2018).

Coefficients associated with \(a\), \(b\), \(c\), and \(c'\) paths are respectively \(a_{21}\), \(b_{32}\), \(c_{11}\), and \(c'_{31}\).

Variable coding

Because joint-significance tests uses linear models behind the scenes, variables involved in the model have to be numeric. mdt_simple will give an error if non-numeric variables are specified in the model.

To convert a dichotomous categorical variable to a numeric one, please refer to the build_contrast function.


Cohen, J., & Cohen, P. (1983). Applied multiple regression/correlation analysis for the behavioral sciences (2nd ed). Hillsdale, N.J: L. Erlbaum Associates.

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_within()


## fit a simple mediation model data(ho_et_al) ho_et_al$condition_c <- build_contrast(ho_et_al$condition, "Low discrimination", "High discrimination") mdt_simple(data = ho_et_al, IV = condition_c, DV = hypodescent, M = linkedfate)
#> Test of mediation (simple mediation) #> ============================================== #> #> Variables: #> #> - IV: condition_c #> - DV: hypodescent #> - M: linkedfate #> #> Paths: #> #> ==== ============== ===== ======================= #> Path Point estimate SE APA #> ==== ============== ===== ======================= #> a 0.772 0.085 t(822) = 9.10, p < .001 #> b 0.187 0.033 t(821) = 5.75, p < .001 #> c 0.171 0.081 t(822) = 2.13, p = .034 #> c' 0.027 0.083 t(821) = 0.33, p = .742 #> ==== ============== ===== ======================= #> #> Indirect effect index: #> #> Indirect effect index is not computed by default. #> Please use add_index() to compute it. #> #> Fitted models: #> #> - X -> Y #> - X -> M #> - X + M -> Y