Introduction to Mediation and Moderation

Presenter(s): Oliver Perra


decorative image to accompany text

This resource will introduce key concepts and practical examples of mediation analysis and moderation analysis. The examples provided will be mostly based on extensions of ordinary least square approaches, including practical examples and exercises using R software. 

Mediation models assume that a third variable accounts for the relation between a predictor and an outcome. In other words, the predictor influences the outcome by affecting one or more variables which, in turn, influence the outcome. Mediation models thus investigate how a predictor influences outcomes, or else, which are the intermediate variables and processes that may transmit the effect of the predictor on to the outcomes of interest. Mediation models are used in both experimental and observational settings to understand the mechanisms by which predictors like treatments or exposures influence outcomes. 

A moderator is a variable that can instead qualify the relation between a predictor and an outcome. In other words, the influence that a predictor exerts on an outcome may depend on the values of a third variable. Conditionally on the values of the moderator, the effect of the predictor on an outcome may be different in strength or sign. Analysis of moderation effects therefore concerns the context in which a predictor influences an outcome. For example, some interventions may be more effective among people with some characteristics, or the link between an exposure and an outcome may vary depending on some contextual variable. 

Video 1 – Simple Mediation Models

A simple mediation model involves a single mediator that transmits the effect of a predictor on an outcome. Using an Ordinary Least Squares (OLS) approach, the total effect of the predictor on the outcome can be partitioned into a direct effect of the predictor while controlling for the mediator, and an indirect effect that gauge the effect of the predictor through the mediator. Using an OLS approach the indirect effect can be estimated as the product of the effect predictor → mediator and the effect mediator → outcome. Tests of significance of the indirect effect had traditionally relied on assumptions of normal sampling distributions that have been questioned by further investigation. For this reason, authors suggest that tests of significance of the indirect effect should rely on resampling approaches, e.g. Bootstrapping or Montecarlo.

> Download R file script example.



   Download transcript    |   Download slides [ 167 Views ]

Video 2 – Mediation Models with Multiple Mediators and Longitudinal Mediation Models

OLS-based approaches allow to investigate models with multiple mediators in parallel, as well as models where mediators influence other mediators serially. Mediation models however are inherently causal models that assume causal links between variables. Causal links imply processes of influence that require time to unfold. In order to investigate these effects and estimate them reliably, longitudinal data are necessary.

> Download R file script example.



   Download transcript    |   Download slides [ 106 Views ]

Video 3 – Visualising and Probing Moderation Models

Moderation involves that the effect of a predictor on an outcome varies according to the values of a third variable (moderator). These analyses provide results that may be difficult to describe insofar they require interpretation of the way of different coefficients combine. Plotting the effects predicted by a moderation model is thus pivotal in explaining and illustrating the meaning of the moderation effect. Furthermore, moderation effects can be “probed” to further clarify how the effects of the predictor vary conditionally on the moderator. 

> Download R file script example.



   Download transcript    |   Download slides [ 117 Views ]

> Download exercises (and solutions) files.




More on this topic

About the author

Dr Oliver Perra is a lecturer at the School of Nursing and Midwifery, Queen’s University Belfast. His research revolves around the early experiences that explain differences in children’s adaptation and socio-cognitive abilities. He explores these issues by applying a transactional approach: this allows to investigate how interactions between children's characteristics and modifiable environmental factors can affect children's developmental pathways.

Primary author profile page



BACK TO TOP