Differences between revisions 1 and 2
Revision 1 as of 2025-04-03 21:51:39
Size: 2022
Comment: Initial commit
Revision 2 as of 2025-05-15 15:46:45
Size: 2191
Comment: Clarification
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

Note that there is a difference between '''mediation''' and '''moderation'''. The latter deals with how a causal link differs across levels of a moderating variable.

Mediation Analysis

Mediation analysis is a decomposition of causal effects based on a mediator variable.

Note that there is a difference between mediation and moderation. The latter deals with how a causal link differs across levels of a moderating variable.


Description

In circumstances where a significant relationship has been found between an independent and dependent variable, but no causal mechanism has been identified, it is possible to propose hypotheses that a third mediator variable completes the causal model.

path.png

The effects pictured are:

  • direct effect of X on Y = β1

  • direct effect of X on M = β2

  • direct effect of M on Y = β3

  • indirect effect of X on Y = β23

  • total effect of X on Y = β1 + (β23)

This can be estimated with the Sobel test, but best practice is to use a bootstrapping method.


Example

The Sobel test approach, using the multilevel package:

library(multilevel)

sorel(data$X, data$M, data$Y)

This displays:

  • the component models, including the estimated coefficients and intercepts
  • the indirect effect
  • the pooled standard error
  • the calculated Z statistic

The bootstrapping approach, using the mediation package:

XonY <- lm(Y ~ X, data = data)
XonM <- lm(M ~ X, data = data)
XMonY <- lm(Y ~ X + M, data = data)

library(mediation)

mediate(XonM, XMonY, treat='X', mediator='M', boot=TRUE, sims=500)

This displays:

  • the average causal mediation effects (ACME), the key measure of this bootstrapping method

    • if significantly different than 0, then there is a significant mediation effect

  • the average direct effects (ADE)

  • the total effect
    • total effect = ACME + ADE

  • the proportion of the total effect that was mediated
    • prop = ACME / total effect


CategoryRicottone

Statistics/MediationAnalysis (last edited 2025-05-15 15:46:45 by DominicRicottone)