
22. Mediation
In this lecture we aim to:
- Explore mediation analysis
- Link it to regression
- Introduce the Process module
- Demonstrate in JASP
Reading: Chapter 10 (§10.2, §10.4–10.7)
Applet
Multiple regression
\(\widehat{\text{album sales}} = b_0 + b_1 \text{airplay} + b_2 \text{adverts}\)
- Boxes are variables, lines are \(b\)s
- No arrows, so no causal claim
Mediation
Mediation

In statistics, a mediation model is one that seeks to identify and explain the mechanism or process that underlies an observed relationship between an independent variable and a dependent variable via the inclusion of a third hypothetical variable, known as a mediator variable (also a mediating variable, intermediary variable, or intervening variable).
Source: WIKIPEDIA
Example
Tal-Or et al. (2010, Study 2, \(n\) = 123): Testing causal direction in the influence of presumed media influence
Does an article about a sugar shortage on the front page increase the intention to buy sugar, or is this effect mediated by presumed media influence?
Condition: article on the front page (1) or an inside page (0), randomized (predictor)MediaInfluence: mean of 2 questionnaire items, 1 to 7 (mediator)- How much they think others will buy sugar after reading the article
Intention: mean of 4 questionnaire items, 1 to 7 (outcome)- Agreement with possible reactions to the article, such as buying sugar
Only Condition was randomized, so path \(a\) is causal but path \(b\) may be confounded or reversed
Total effect
- Total effect:
- \(\widehat{\text{Outcome}} = b_0 + b_t \text{Predictor}_i\)
Mediation paths
You found my sneaky text to create space! You are awesome. Muahahahahahahahahahahahahahahahahahahahahahahahaha haha…hah.. uhhhh
- Total effect:
- \(\widehat{\text{Outcome}} = b_0 + b_t \text{Predictor}_i\)
- Mediator effect (a):
- \(\widehat{\text{Mediator}} = b_0 + b_a \text{Predictor}_i\)
- Combined effect (b + c):
- \(\widehat{\text{Outcome}} = b_0 + b_{c} \text{Predictor}_i + b_b \text{Mediator}_i\)

The data
Fit 3 models
model.outcome.predictor <- lm(intention ~ condition)
model.mediator.predictor <- lm(media.influence ~ condition)
model.combined <- lm(intention ~ condition + media.influence)- Total effect:
- \(\widehat{\text{Outcome}} = b_0 + b_t \text{Predictor}_i\)
- Mediator effect:
- \(\widehat{\text{Mediator}} = b_0 + b_a \text{Predictor}_i\)
- Combined effect:
- \(\widehat{\text{Outcome}} = b_0 + b_{c} \text{Predictor}_i + b_b \text{Mediator}_i\)

Extract beta coefficients
b.outcome.predictor <- model.outcome.predictor$coefficients[2] # b.t
b.mediator.predictor <- model.mediator.predictor$coefficients[2] # b.a
b.combined.mediator <- model.combined$coefficients[3] # b.b
b.combined.predictor <- model.combined$coefficients[2] # b.c- Total effect:
- \(\widehat{\text{Outcome}} = b_0 + b_t \text{Predictor}_i\)
- Mediator effect:
- \(\widehat{\text{Mediator}} = b_0 + b_a \text{Predictor}_i\)
- Combined effect:
- \(\widehat{\text{Outcome}} = b_0 + b_{c} \text{Predictor}_i + b_b \text{Mediator}_i\)

View beta coefficients

Path plot

Visual

Calculate indirect effect
\(a \times b = b_a \times b_b\)
indirect <- b.mediator.predictor * b.combined.mediator; indirect # a * b[1] 0.2413355
indirect + b.combined.predictor # a * b + c [1] 0.4956897
b.outcome.predictor # total effect[1] 0.4956897

Effect sizes of mediation
- Simplest is \(ab\) itself with its CI, in units of the outcome
- Partially standardized, \(\frac{ab}{s_{Outcome}}\)
- Standardized (index of mediation), \(\frac{ab}{s_{Outcome}} \times s_{Predictor}\), to compare studies
- Options → Standardized estimates
Is the indirect effect significant?
- Test the indirect effect \(a \times b\) itself
- JASP gives its estimate, \(p\)-value and 95% CI
- In the Direct and indirect effects table
- Significant indirect effect if \(p < \alpha\)
- The CI shows how precisely \(a \times b\) is estimated
- Assumptions problematic? Bootstrap the indirect effect
- Options → Method → Bootstrap
- Only the CI is bootstrapped, not the \(p\)-value
| 95% Confidence Interval | ||||||
|---|---|---|---|---|---|---|
| Estimate | Std. Error | z-value | p | Lower | Upper | |
| Condition → Intention | 0.254 | 0.253 | 1.007 | .314 | -0.241 | 0.750 |
| Condition → MediaInfluence → Intention | 0.241 | 0.127 | 1.902 | .057 | -0.007 | 0.490 |
Checking the assumptions
Where to check each assumption in JASP (mediator and combined models)1
| Assumption | In JASP | Looks fine when |
|---|---|---|
| Multicollinearity (combined model) | Statistics → Coefficients → Tolerance and VIF | all VIFs below 10, average close to 1 |
| Linearity, equal variances | Plots → Residuals vs. predicted | a random cloud around 0 |
| Normality of the residuals | Plots → Q-Q plot standardized residuals → Confidence interval | points close to the line, mostly within the band |
| Outliers, influential cases | Statistics → Residuals → Casewise diagnostics | about 5% of std. residuals beyond \(\pm 2\) at most, Cook’s distance below 1 |
Caution with Process models
When we test such hypotheses with the help of path models applied to observational data, we are in the business of causal inference on the basis of observational data
Equivalent models
Which way do the arrows point? The data cannot tell!

- X, M and Y are the predictor, mediator and outcome of model 1
- All four reproduce the observed correlations exactly
- Randomizing X (like
Condition) rules out models 2 and 4 - Models 1 and 3 still differ in the direction of the M-Y arrow
More examples
- Crazier example - Age and Fatigue
- For the exam, max 1 mediator (but see Section 10.4.7)
JASP
Closing
Recap
- Mediation analysis is a way to model dependence between predictors
- Process module is very flexible
- Causal assumptions extremely important with Process models
Exam note
- For the exam, max 1 mediator
- Read paths \(a\), \(b\) and \(c\) from the Path coefficients table
- Test mediation with the \(p\)-value of the indirect effect \(a \times b\)
Next Time
- Moderation: interactions between continuous predictors
Recommended Exercises
Labcoat Leni 10.1
Massar et al. (2012): I heard that Jane has a boil and kissed a tramp
Do younger women gossip more, and is this mediated by their mate value?
age: 20 to 50 (predictor)mate_value: sexual desirability (mediator)gossip: tendency to gossip (outcome)
Contact
Footnotes
The Process module has no residual plots or collinearity statistics, so fit both models in Linear Regression.↩︎

