Skip to content
Grad Coach

Diagram · CC BY 4.0

Mediating variable example: fertilizer, soil nitrogen and plant height

Fertilizer raises soil nitrogen, which raises plant height: the indirect effect, with the direct effect beside it.

A simple mediation model with a worked example, in two panels. The upper panel shows the total effect: amount of fertilizer in g per pot (X, independent variable) affects plant height in cm (Y, dependent variable) through path c = 0.8 cm per g. The lower panel adds soil nitrogen in mg/kg (M, mediator) between them. Path a, from fertilizer to soil nitrogen, is 4 mg/kg per g. Path b, from soil nitrogen to plant height with fertilizer held constant, is 0.15 cm per mg/kg. The direct path c′, from fertilizer to plant height with soil nitrogen held constant, is 0.2 cm per g. Lines below the diagram give the indirect effect, ab = 4 × 0.15 = 0.6 cm per g, and the total effect as the sum of the direct and indirect effects, c = c′ + ab = 0.2 + 0.6 = 0.8 cm per g. The mediator's box has a light neutral fill. Orange arrows mark the indirect path through the mediator (a, then b); black arrows mark the path from X straight to Y, which is the total effect c in the upper panel and the direct effect c′ in the lower, as the key states.

Swipe sideways to see the whole diagram, or download the PNG.

Mediation model with total, direct and indirect effects - fertilizer example. Derek Jansen, Grad Coach, CC BY 4.0.

What it shows

The total effect of fertilizer on plant height, c = 0.8 cm per g, and the same relation split through a mediator, soil nitrogen.

Path a (fertilizer to nitrogen) is 4 mg/kg per g, path b (nitrogen to height) is 0.15 cm per mg/kg, and the direct path c′ is 0.2 cm per g.

How to read it

  1. Follow the orange arrows for the indirect path: X to M, then M to Y. The black arrow runs from X straight to Y: the total effect c on top, the direct effect c′ below.

  2. Multiply along the orange path for the indirect effect, ab = 4 × 0.15 = 0.6 cm per g.

  3. Add the direct path to get the total: c = c′ + ab = 0.2 + 0.6 = 0.8 cm per g.

The paths (illustrative values)

  • a = 4 mg/kg per g: each gram of fertilizer raises soil nitrogen by 4 mg/kg.
  • b = 0.15 cm per mg/kg: each mg/kg of nitrogen adds 0.15 cm, with fertilizer held constant.
  • c′ = 0.2 cm per g: the direct effect, with soil nitrogen held constant.
  • ab = 0.6 cm per g, the indirect effect; c = 0.8 cm per g, the total effect.

Ways to use it in teaching

  • Students compute ab and c from the three path values, then check that c = c′ + ab.

  • Set it beside the moderation diagram: a mediator explains how X affects Y, a moderator when or how strongly.

For how studies name and control their variables, see our guide to research variables.

Sources

  • Baron, R. M., & Kenny, D. A. (1986). The moderator–mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology, 51(6), 1173–1182. https://doi.org/10.1037/0022-3514.51.6.1173
  • Hayes, A. F., & Preacher, K. J. (2010). Quantifying and testing indirect effects in simple mediation models when the constituent paths are nonlinear. Multivariate Behavioral Research, 45(4), 627–660. https://doi.org/10.1080/00273171.2010.498290
  • Mediation (statistics). (n.d.). In Wikipedia. Retrieved October 19, 2026, from https://en.wikipedia.org/wiki/Mediation_(statistics)

Inference and evidence

Related diagrams

All open educational resources

Need something else?

Tell us which diagram, template or worked examples would help your teaching, and we’ll do our best to add it to the collection.