# Setting up a mediation model

I'm having trouble understanding how to set up a simple mediation model.

IV: hours of sleep

M: amount of exercise

DV: score on some test

I'm expecting the relationship between sleep and test score to be mediated by exercise.

From what I understand, where are 3 regressions that need to be tested:

• Path A: relationship between exercise and sleep
• Path B: relationship between score and exercise
• Path C (direct): relationship between score and sleep

I'm trying to understand the details of these regression models and what should and should not be included in them. I'm looking to see if my understanding of the models below is correct, and questions are bolded:

Path A

This is using sleep to predict exercise:

mdlA <- lm(exercise ~ sleep, data=data)

Path B

Using exercise (mediator) to predict score:

mdlB <- lm(score ~ exercise, data=data)

Should this model also include sleep? i.e.:

mdlB <- lm(score ~ exercise + sleep, data=data)

My path B coefficient is the one associated with exercise (regardless of which of the 2 models I use)

Path C

This is the direct effect:

mdlC <- lm(score ~ sleep, data=data)

Should this model also include the mediator? i.e.:

mdlC <- lm(score ~ sleep + exercise, data=data)

My C coefficient would then be the one associated with sleep

Once I have my 3 coefficients, I then need to bootstrap the total indirect effect (A*B) and test it against 0. If it is significant, then I have mediation

Whether I have partial or complete mediation is then determined by whether Path C is significant? Or does mediation always required all 3 paths to be significant?

I think this might depend on what model I used for Path C. If I add the mediator into the Path C model, then significance would tell me I have partial mediation. But non-significant would tell me I have complete mediation?

Am I missing anything from the steps required to conduct this type of analysis?

Path A and Path B are fine. Below are all the steps to test mediation effect:

mdlA <- lm(exercise ~ sleep, data=data)
mdlB <- lm(score ~ exercise, data=data)
mdlC <- lm(exercise ~ sleep, data=data)
mdlB <- lm(score ~ sleep + exercise, data=data)


If the first three models are significant, you conduct the fourth model. In the fourth, if sleep is non-significant, when exercise is controlled, existence of mediation is supported.
One caveat here is that both exercise and sleep are likely to independently influence score. In such a scenario, sleep might be significant which indicates partial mediation. The two independent variables might interactively (jointly) influence dependent variable score. In this case, you have moderation effect.
For a little more elaboration, have a look at the thread Testing mediation and moderation; can one variable function as both mediator and moderator?.

Your approach for testing full/partial mediation is correct. You can use Sobel's test (If sample size is large enough/assumptions are met) Or bootstrapping to do the same.

If you are using SPSS, installing process macro by Andrew F. Hayes will solve your purpose/