Linear Regression · General Linear Model
Mediation Analysis
Mediation analysis tests whether an effect runs through a middle variable.
Mediation analysis takes a predictor, a proposed mediator and an outcome measured on the same people, and tests whether part of the predictor's link with the outcome runs through the mediator.
Does mindfulness practice go with fewer depressive symptoms partly because it goes with less brooding? Two hundred adults reported their daily minutes of mindfulness practice and completed a brooding scale and the PHQ-9 depression questionnaire, all in one online survey.
- Tests
- Population indirect effect
- Observations
- Independent
- Headline Statistic
- ab
- Effect Size
- Completely Standardized Indirect Effect
- Groups
- 1
The Basics
When to Use It
Use it when you have a predictor, an outcome and a proposed mediator in between, measured on the same people, and you want to know whether part of the predictor's relationship with the outcome runs through the mediator, and how much. The mediator and outcome should be continuous. The predictor can be continuous or two groups, such as treatment and control: code the groups 0 and 1, and the steps stay the same, with the predictor's link to the mediator becoming the difference between the groups' average mediator scores. It needs a causal story, X → M → Y, that you can defend on theory or design before you look at the data. For example:
- Does mindfulness practice go with fewer depressive symptoms partly because it goes with less brooding?
- Does a sleep-extension intervention improve next-day mood by reducing daytime sleepiness scores?
- Does parental warmth predict adolescents' GPA through higher academic self-efficacy scores?
Vocabulary You Need
Definition Mediator (M)
A variable that sits in the middle of a proposed causal chain, X → M → Y: X changes M, and M in turn changes Y. It answers how, or why, X affects Y. Calling a variable a mediator is a causal claim; the statistics can show that data fit the chain, not prove it. A moderator is different: it changes how strongly X and Y are related. Glossary →
Definition Indirect Effect (ab)
The part of X's relationship with Y that travels through the proposed mediator: path a (how much M differs per unit of X) times path b (how much Y differs per unit of M, holding constant the other variables with arrows into Y; in simple mediation, that's X). It's in the outcome's units per unit of X. It's called an effect because mediation proposes a causal chain; the numbers alone show a pattern of association that fits it. The product of two estimates has a lopsided sampling distribution, so it's usually tested with a bootstrap confidence interval rather than a z or t test. Glossary →
Definition Direct Effect (c')
How much Y differs per unit of X among people with the same mediator score, written c′ (“c prime”). With one mediator, it and the indirect effect add up to the total effect, c = c′ + ab. It's whatever part of X's relationship with Y the mediator doesn't carry, which in practice includes any other mediators left out of the model. A direct effect near zero doesn't prove the mediator carries the whole effect; it may just be too small to detect. Glossary →
Definition Total Effect (c)
Every route from X to Y added up, direct and indirect: how much Y differs per unit of X. In a model with every arrow free, such as simple mediation, it equals the slope from regressing Y on X alone, and when all the models are ordinary (OLS) linear regressions on the same cases it splits exactly into the direct and indirect effects, c = c′ + ab; the split doesn't hold for logistic or other nonlinear models. In a model that leaves arrows out, it's the model's implied total, which can differ from that slope. Glossary →
Definition Bootstrap Confidence Interval (CI)
A confidence interval built by resampling. Draw a sample of the same size from the data with replacement, recompute the statistic, and repeat thousands of times; the percentile version then takes the middle 95% of the recomputed values. It doesn't assume the statistic has a normal sampling distribution, so it can be lopsided around the estimate. Resampling is random, so the limits shift slightly from run to run and between programs unless the random seed is fixed. Glossary →
Assumptions
1. Correct Causal Order Each variable comes before the variables its arrows point to, in the order you propose.
- What It Means
- Mediation is a claim about a causal chain, X → M → Y. The analysis takes that order as given; it can't tell X → M → Y apart from other orders, such as Y → M, that fit the same correlations.
- Applies To
- Relationship
- How to Check
- By design and theory, not by a test. Was X manipulated, or measured before M, and M before Y? With everything measured at once, the order rests on argument alone.
- How Much It Matters
- Everything. If depressed mood drives brooding, or symptoms lead people to stop practicing, the same numbers describe a different story, and the indirect effect means nothing as a mechanism. In the mindfulness study all three were measured in one survey, so the order rests on theory alone. Cross-sectional estimates of longitudinal mediation can be badly biased (Maxwell & Cole, 2007).
If It's Violated
- Design Change Measure the predictor, the mediator and the outcome at separate, successive times, ideally with earlier levels of each so change can be modeled.
- Design Change Randomly assign people to practice (or not). That settles the order of the predictor and protects paths a and c, though not path b.
- Proceed with Caveat With one-time data, report that the results fit the proposed chain and name the other orders they fit equally well.
2. No Hidden Common Causes Nothing you left out drives any two of the variables in the chain.
- What It Means
- Reading the paths as effects needs no unmeasured variable that drives the predictor and the mediator, the predictor and the outcome, or the mediator and the outcome, and no common cause of the mediator and the outcome that the predictor itself changes. If one exists, the paths it touches partly reflect it, and so does the indirect effect. Randomizing the predictor rules out common causes of the predictor and either of the others; it does nothing for the mediator and the outcome, because people aren't randomized to levels of the mediator. When the predictor is only measured, every pair is open.
- Applies To
- Relationship
- How to Check
- By reasoning about the design. For each pair of variables in the chain, list plausible common causes, measure the important ones and include them as covariates, and say which ones you couldn't rule out.
- How Much It Matters
- A lot, for every path and so for the indirect effect. Neuroticism, for example, could raise both brooding and depressive symptoms, making b (and ab) too large. In the mindfulness study practice wasn't assigned either, so something like conscientiousness or free time could drive practice as well as brooding and symptoms, biasing a, c and c′ too. No statistic in the output can detect it.
If It's Violated
- Correction Measure likely common causes of each pair of variables and include them as covariates in both regressions.
-
Proceed with Caveat
Report how strong an unmeasured confounder would have to be to erase the indirect effect, for example with the sensitivity analysis in R's mediation package (
medsens()). - Design Change In a separate study, change the mediator directly (for example, a brooding-reduction exercise) and see whether the outcome follows.
3. Independent Observations The people (or other units) in your study don't influence each other.
- What It Means
- Each person's data comes from a separate, unconnected source, so knowing one person's scores tells you nothing about anyone else's. In designs that measure people more than once, their own scores are meant to be related; it's different people who must be independent. Methods built for clustered data, such as multilevel models and GEE, also allow members of the same group to be related, as long as the analysis names the grouping; then it's the groups that must be independent.
- Applies To
- Observations
- How to Check
- By design, not by a test. Did each person contribute their own data, with no clusters such as roommates, couples, therapy groups or classrooms whose members influence each other? If there are clusters, does the analysis model every one of them?
- How Much It Matters
- A lot. Clustered people, such as members of the same meditation class, make the standard errors too small and the bootstrap too optimistic, because resampling single people ignores the clusters.
If It's Violated
- Alternative Test Multilevel SEM. A multilevel model separates within-cluster and between-cluster paths.
- Design Change Sample unrelated people, one survey each.
4. Linear Relationship The relationship between your variables follows a straight line, not a curve.
- What It Means
- As one variable goes up, the other tends to change by about the same amount across its whole range. A curved relationship, one that levels off or a U shape, breaks this.
- Applies To
- Relationship
- How to Check
- Look at a scatterplot of each pair of variables the analysis relates: a roughly oval cloud tilted one way is fine; a clear bend, a ceiling or a U is not. In a regression with several predictors, plot the residuals against the predicted values instead: a flat, even band is fine; a curve means the model is missing a bend. A component-plus-residual plot for each predictor (R: car::crPlots) shows whether one of them bends once the others are held constant.
- How Much It Matters
- A lot, for what the paths mean. Each path is a straight-line slope; if brooding levels off at high practice, a understates the relationship at low practice and overstates it at high practice, and ab averages over that.
If It's Violated
- Transformation Log-transform a variable whose relationship levels off, such as practice minutes, and interpret the path on that scale.
- Proceed with Caveat Add a squared term to the regression and report how the indirect effect changes across the range of the predictor.
5. No Predictor × Mediator Interaction The mediator relates to the outcome about equally strongly at every level of the predictor.
- What It Means
- The outcome model, Ŷ = i_Y + c′X + bM, gives the mediator one slope, b, for everyone. If brooding goes with symptoms more strongly among people who practice little than among people who practice a lot, there's no single b, and so no single indirect effect ab, only a different one at each level of practice.
- Applies To
- Relationship
- How to Check
- Add the product of the predictor and the mediator (practice × brooding) to the outcome model and look at its coefficient and interval, alongside a plot of the outcome against the mediator for low and high values of the predictor. Treat the interaction test as a supporting check, not a gate: in a small sample a non-significant interaction doesn't show there is none.
- How Much It Matters
- Some to a lot, for what ab means. With an interaction, ab averages indirect effects that differ across the predictor's range. Here the interaction is small and the data can't tell it from zero: −0.011 (SE 0.012), t(196) = −0.91, p = .37.
If It's Violated
-
Proceed with Caveat
Keep the interaction and estimate the indirect effect at a few meaningful values of the predictor, for example with PROCESS model 74 or R's mediation package (
mediate()with an outcome model that includes the treat × mediator term).
6. Normality The scores the test relies on are roughly bell-shaped, or your sample is big enough that it doesn't matter.
- What It Means
- The test's model assumes the scores it relies on are roughly normal: the scores within each group (or the scores themselves, for a one-sample test), the difference scores in a paired design, or the residuals (the errors left around a model's predictions) in a regression. For p-values and confidence intervals, what really matters is that the estimates (such as a mean, a difference between means or a model's coefficients) are roughly normal across repeated samples. A large enough sample usually provides that; how large depends on how skewed the scores are and how extreme their outliers.
- Applies To
- Residuals
- How to Check
- Look at a histogram or Q–Q plot for strong skew or extreme outliers. Don't rely on a normality test: with small samples it misses real problems, and with large ones it flags trivial ones.
- How Much It Matters
- Little for the indirect effect, which is tested by bootstrapping and doesn't assume normality. More for the t tests of the individual paths in small samples. With 200 people and roughly symmetric residuals, it's fine here.
If It's Violated
- Robust Estimation Report bootstrap intervals for c′ and c as well as for ab.
- Transformation Transform a strongly skewed outcome, such as symptom counts in a community sample, and interpret the results on that scale.
7. Equal Spread of Residuals Your scores scatter about equally around the predictions, whatever the prediction.
- What It Means
- The residuals have about the same spread at every predicted value, so the model misses by about as much for people predicted to score low as for people predicted to score high. The opposite, heteroscedasticity, often looks like a funnel. If the model's form is right, unequal spread doesn't bias the coefficients, though it makes them less precise than they could be; it does make their standard errors, and so the p-values and confidence intervals, unreliable.
- Applies To
- Residuals
- How to Check
- Plot each regression's residuals against its predicted values: brooding on practice, and PHQ-9 on practice and brooding (in the SPSS REGRESSION procedure, *ZRESID against *ZPRED). A band of even width is fine; a funnel or fan that widens or narrows is not. Don't use a test such as Breusch–Pagan as a gatekeeper: with small samples it misses real problems, and with large ones it flags trivial ones.
- How Much It Matters
- Some. Unequal spread on its own doesn't bias the paths (Williams et al., 2013), but it distorts the standard errors of c′ and b, and so their t tests; the bootstrap interval for ab, which resamples whole people, is less affected.
If It's Violated
- Robust Estimation Use heteroscedasticity-consistent standard errors, such as HC3, for the individual paths (Hayes & Cai, 2007).
- Transformation A log or square-root transformation can even out a spread that grows with the outcome.
Limitations
This Is Not Your Test If…
- You only want to know whether one variable predicts another Simple Linear Regression →
- You think a relationship is stronger or weaker at different levels of a third variable Moderation Analysis →
- You have two or more mediators, or a longer chain Path Analysis →
- Your mediator or outcome is yes/no Logistic Regression →
- People are nested in groups, or measured repeatedly Multilevel SEM →
What It Doesn't Tell You
- Why, or in what order. All three measures came from one survey, so the data fit practice → less brooding → fewer symptoms, but they fit symptoms → more brooding → less practice just as well. Cross-sectional estimates of a process that unfolds over time can be badly biased (Maxwell & Cole, 2007).
- Whether brooding is the real mechanism. A hidden common cause, such as neuroticism, could drive both brooding and symptoms and create an indirect effect on its own. Other mediators left out of the model end up in the direct effect. So does measurement error: an unreliable brooding score shrinks b and ab and inflates c′, so part of the remaining direct effect may be an artifact. Latent-variable (SEM) mediation can correct for it.
- Whether it matters. An indirect effect of −0.100 PHQ-9 points per minute is about 1 point for 10 extra minutes a day, on a 27-point scale. Significance doesn't make that clinically meaningful.
- Who else. The result describes adults like these 200 survey respondents, over the range of practice they reported (0 to 42 minutes a day), and only as well as self-reports capture practice, brooding and mood.
- That there's no mediation, if the interval had included zero. An interval that included zero would have meant the data were inconclusive about the indirect effect, not that brooding plays no part.
Common Mistakes
-
Don'tClaim that brooding explains the effect from data collected at a single time.
InsteadSay the data are consistent with the proposed chain, and test it with measurements over time or a manipulated predictor.
-
Don'tRequire a significant total effect before looking for an indirect effect.
InsteadTest the indirect effect directly. It can be real even when c is small or not significant, for example when the direct and indirect effects point in opposite directions and cancel out (sometimes called inconsistent mediation).
-
Don'tStop at “a and b are each significant.”
InsteadAlso estimate ab and give its bootstrap interval, so readers can see how big the indirect effect is and how precisely it's known.
-
Don'tCall it “full mediation” because the direct effect isn't significant.
InsteadReport c′ with its interval. A non-significant direct effect may just be too small for your sample to detect.
-
Don'tTest the indirect effect with the Sobel test's normal-theory p.
InsteadUse a bootstrap interval. The product ab has a skewed sampling distribution in samples of ordinary size.
-
Don'tReport the bootstrap limits to four decimals as if they were fixed.
InsteadReport the number of resamples and the seed. The limits shift slightly with the seed and the software.
-
Don'tMultiply a linear path by a logistic one when the mediator or outcome is yes/no.
InsteadUse causal mediation with a logistic model for that variable. Linear and log-odds coefficients are on different scales, so their product isn't an indirect effect on either.
-
Don'tDescribe a regression coefficient as the effect of raising the predictor.
InsteadSay the prediction is that much higher per unit of the predictor, on the model's scale (the outcome itself, or its log-odds or log rate in a logistic, ordinal or Poisson model). Causal language needs a design that supports it, such as an experiment.
-
Don'tRead a p-value as the chance that the null hypothesis is true.
InsteadRead it as: if the null were true, how often data at least this extreme would turn up.
Result Decoder
Significance Guidelines
Benchmarks Significance (p Value)
-
p < .001
Very strong evidence against the null hypothesis.
-
.001 ≤ p < .01
Strong evidence against the null hypothesis.
-
.01 ≤ p < .05
Statistically significant at α = .05. Moderate evidence against the null hypothesis.
-
.05 ≤ p < .10
Not significant. Weak evidence; sometimes called a “trend.” Treat it as inconclusive.
-
p ≥ .10
Not significant. Little evidence against the null, which is not the same as evidence of no effect.
These evidence labels are one common convention for describing p in graded language rather than as significant or not; the boundaries are rough guides, not rules, and other authors draw them differently. Muff et al. (2022) argue for this kind of language of evidence over a single cutoff. α is chosen before the analysis, and p never says how big or important an effect is.
How It's Reported
Equation Form
ab = −0.100, 95% bootstrap CI [−0.146, −0.059], abcs = −0.16; c′ = −0.096, t(197) = −2.36, p = .019
Table 1. Means, Standard Deviations and Correlations
| M | SD | 1 | 2 | |
|---|---|---|---|---|
|
20.00 | 8.00 | ||
|
11.00 | 3.00 | −.36 | |
|
9.00 | 5.00 | −.31 | .50 |
Note. N = 200. Practice is average minutes a day; brooding is the RRS brooding subscale (5–20); PHQ-9 runs 0–27.
Table 2. Paths in the Mediation Model (Practice → Brooding → PHQ-9)
| Estimate | SE | t | p | 95% CI | |
|---|---|---|---|---|---|
| a: Practice → Brooding | −0.134 | 0.025 | −5.36 | < .001 | [−0.183, −0.085] |
| b: Brooding → PHQ-9 | 0.749 | 0.108 | 6.93 | < .001 | [0.536, 0.963] |
| c′: Direct effect | −0.096 | 0.041 | −2.36 | .019 | [−0.176, −0.016] |
| c: Total effect | −0.196 | 0.042 | −4.64 | < .001 | [−0.279, −0.113] |
| ab: Indirect effect | −0.100 | 0.023 | [−0.146, −0.059] |
Note. Unstandardized coefficients. a comes from regressing brooding on practice; b and c′ from regressing PHQ-9 on practice and brooding together; c from regressing PHQ-9 on practice alone. For the indirect effect ab, the SE is the bootstrap standard error and the interval is a 95% percentile bootstrap interval from 5,000 resamples; t and p are left blank because the interval is the test.
Full Text (APA Style)
Participants practiced mindfulness for an average of 20.00 minutes a day (SD = 8.00), scored 11.00 on brooding (SD = 3.00) and 9.00 on the PHQ-9 (SD = 5.00). Each extra daily minute of practice went with 0.196 fewer PHQ-9 points overall (c). Practice was associated with less brooding (a = −0.134, p < .001), and brooding with more symptoms when practice was held constant (b = 0.749, p < .001). The indirect effect through brooding was −0.100 points per minute, 95% percentile bootstrap CI [−0.146, −0.059] (5,000 resamples, seed 20260928), a completely standardized indirect effect of −0.16. Practice was still associated with fewer symptoms with brooding held constant, c′ = −0.096, 95% CI [−0.176, −0.016], t(197) = −2.36, p = .019. Because all three measures came from one survey, these results are consistent with mediation but cannot establish it.
- Give each effect in its own units (a in mediator points per unit of the predictor, b in outcome points per mediator point, and c, c′ and ab in outcome points per unit of the predictor), and say what one unit of each variable is.
- Name the interval type, the number of resamples and the seed. Bootstrap limits shift slightly from run to run.
- Report the indirect effect's interval, not a p-value from the Sobel test.
- Match the verbs to the design: “was associated with” for a single survey; “mediated” only with a design that supports the causal order.
Reading Each Piece
The equation form above, piece by piece, in this order: how big, how certain, then how surprising.
| a = −0.134 | Each extra daily minute of practice went with 0.134 fewer points of brooding, on a 5–20 scale. |
| c′ = −0.096 | Comparing people with the same brooding score, each extra daily minute of practice went with 0.096 fewer PHQ-9 points. |
| ab = −0.100 | Under the proposed chain, the part of practice's link with symptoms that goes along with less brooding is 0.100 fewer PHQ-9 points per daily minute, about 1 point for 10 minutes a day. |
| c = −0.196 | Overall, each extra daily minute of practice went with 0.196 fewer PHQ-9 points, about 2 points for 10 minutes a day. About half of that (.51) is the indirect part, if the proposed chain is right, a share that's unstable and should be read loosely. |
| 95% bootstrap CI [−0.146, −0.059] | The indirect effect is plausibly anywhere from 0.059 to 0.146 fewer PHQ-9 points per minute. The whole interval is below zero, so the indirect effect is statistically significant. |
| abcs = −0.16 | People 8 minutes a day (one standard deviation) above average in practice scored 0.16 standard deviations lower on the PHQ-9 along the proposed route through brooding, about 0.8 points. There are no agreed benchmarks for this size. |
| t(197) = −2.36 | The direct effect is 2.36 standard errors below zero. The 197 is the degrees of freedom, n − 3. |
| p = .019 | If practice had no link with symptoms beyond brooding (and the regression model is right), a direct effect at least this far from zero, in either direction, would turn up about 2% of the time. This p is for c′ only; the indirect effect's test is its bootstrap interval. Benchmarks ↑ |
Calculations
The Running Example
The mindfulness study: 200 adults, each reporting practice minutes, brooding and depressive symptoms, asking whether practice goes with fewer symptoms partly through less brooding.
- Null Hypothesis:
- ab = 0
- Alternative (Two-Sided):
- ab \neq 0
ab here is the population indirect effect: the part of practice's link with depressive symptoms that runs through brooding, among all adults like these. The sample's −0.100 estimates it. The test is whether a 95% bootstrap interval for it excludes 0.
What Your Data Should Look Like
One row per person and three numeric columns: the predictor (X), the mediator (M) and the outcome (Y). All three scores on a row must come from the same person, ideally measured in that order over time.
| participant | practice_minutes | brooding | phq9 |
|---|---|---|---|
| 1 | 11 | 10 | 6 |
| 2 | 23 | 10 | 9 |
| 3 | 28 | 13 | 12 |
| 4 | 17 | 9 | 5 |
| 5 | 18 | 11 | 6 |
| 6 | 11 | 13 | 5 |
| … 194 more rows | |||
| M | SD | 1 | 2 | |
|---|---|---|---|---|
| 1. Practice Minutes a Day (X) | 20.00 | 8.00 | ||
| 2. Brooding (M) | 11.00 | 3.00 | −.36 | |
| 3. PHQ-9 (Y) | 9.00 | 5.00 | −.31 | .50 |
N = 200. X is the predictor, M the mediator, Y the outcome.
Correlations are Pearson r.
Simulated data.
Napkin Math
The whole test, one idea at a time. Under each heading, a line says why the step matters, and the green note reads the equation in plain English with the mindfulness study's numbers. Collapse all to read just the headings: they tell the whole story on their own.
-
1. Measure How Much Less People Brood for Each Extra Minute of Practice
The first link in the chain is the predictor's relationship with the mediator. An ordinary regression of brooding on practice gives it as a slope, path a.
\hat{M} = i_M + aX =\hat{M} = 13.67 - 0.134X= −0.134 brooding points per minute
\hat{M} is a participant's predicted brooding score and X their daily practice minutes. The slope a is −0.134: each extra minute a day goes with 0.134 fewer brooding points, so 10 minutes goes with about 1.3 points less. i_M (13.67) is the intercept: the predicted brooding score for someone who practices 0 minutes.
-
2. Measure How Brooding Goes with Symptoms among People Who Practice Equally
The second link is the mediator's relationship with the outcome. Putting practice in the same regression holds it constant, so b isn't just practice's own link with symptoms showing up again.
\hat{Y} = i_Y + c'X + bM =\hat{Y} = 2.67 - 0.096X + 0.749Mb = 0.749 PHQ-9 points per brooding point
\hat{Y} is predicted PHQ-9 and M is brooding. The slope on M, b, is 0.749: among people with the same practice minutes, each extra brooding point goes with 0.749 more PHQ-9 points. i_Y (2.67) is this model's intercept (PROCESS calls it the constant).
-
3. See How Much of Practice's Link Remains Once Brooding Is Held Fixed
The same regression's other slope is the direct effect, c′. It's the part of practice's relationship with symptoms that brooding doesn't carry.
c' =-0.096= −0.096 PHQ-9 points per minute
c' is the slope on X in that regression: holding brooding constant, each extra minute of practice still goes with 0.096 fewer PHQ-9 points.
-
4. Multiply the Two Links to Get the Indirect Effect
If each minute of practice goes with a points less brooding, and each brooding point goes with b more PHQ-9 points (practice held constant), the proposed route through brooding carries a times b. That product is the indirect effect, and it's what mediation is about. “Effect” is just the conventional name for these paths; with one-time data, read each as “goes with”, not “causes”.
ab = a \times b =-0.134 \times 0.749= −0.100 PHQ-9 points per minute
a is our −0.134 brooding points per minute and b is 0.749 PHQ-9 points per brooding point. −0.134 × 0.749 = −0.100 PHQ-9 points per minute: people 10 minutes a day apart in practice differ by about 1 point along the proposed route through brooding.
-
5. Add the Two Routes to Get the Total Effect
The direct and indirect routes together make up practice's whole relationship with symptoms. In regression the split is exact, so the sum matches the slope from regressing symptoms on practice alone.
c = c' + ab =-0.096 + (-0.100)= −0.196 PHQ-9 points per minute
c \text{ (}Y\text{ on }X\text{ alone)} = −0.196
ab \div c = .51
c' is −0.096 and ab is −0.100, so c = −0.196 PHQ-9 points per minute, the same slope a regression of PHQ-9 on practice alone gives. Brooding's share is −0.100 ÷ −0.196 = .51, about half.
-
6. Resample the Data to See How Much the Indirect Effect Could Vary
A product of two estimates has a lopsided sampling distribution, so the usual ± formula doesn't fit. Instead, draw thousands of new samples of 200 from our own data, with replacement, recompute ab in each, and keep the middle 95%. This is Efron's (1979) bootstrap.
\left[\, ab^{*}_{(2.5\%)},\; ab^{*}_{(97.5\%)} \,\right] =\text{middle 95\% of 5{,}000 resampled } ab^{*}= [−0.146, −0.059] PHQ-9 points per minute
Each ab^{*} is the indirect effect in one resample of our 200 participants. Sorting all 5,000 and cutting 2.5% from each end leaves −0.146 to −0.059. Another seed or program gives limits a little different, typically by about 0.002 (R, with the seed in Run It in Software, gives −0.148 and −0.058).
-
7. Put the Indirect Effect in Standard Deviations
Points per minute only make sense to people who know both scales. Converting to standard deviations gives a size that can be compared with studies that used other measures.
ab_{cs} = ab \times \dfrac{s_X}{s_Y} =-0.100 \times \dfrac{8.00}{5.00}= −0.16
s_X is the 8.00-minute spread in practice and s_Y the 5.00-point spread in PHQ-9. −0.100 × 8.00 ÷ 5.00 = −0.16: people one SD apart in practice differ by 0.16 SD in symptoms along the proposed route through brooding.
-
8. Check Whether a Direct Link Remains beyond Brooding
The direct effect is an ordinary regression slope, so it has a standard error and a t test. t counts how many standard errors c′ sits from zero.
t = \dfrac{c'}{SE_{c'}}, \quad df = n - 3 =df = 200 - 3, \quad t = \dfrac{-0.096}{0.041}= −2.36
SE_{c'} = 0.041
c' is −0.096 and its SE_{c'} is 0.041, so c′ sits 2.36 standard errors below zero (with the unrounded −0.0957 and 0.0406; the rounded values give 2.34). The outcome model estimates three coefficients, so df = 200 − 3 = 197.
-
9. Ask How Surprising That Direct Link Would Be If There Were None
Finally, ask how often a direct effect at least this far from zero, in either direction, would turn up if practice had no link with symptoms beyond brooding.
p = 2 \times P(T_{df} \le -|t|) =2 \times P(T_{197} \le -2.36)= .019
P(T_{197} \le -2.36) is the chance a t with 197 df lands at or below −2.36. Doubling it counts both directions: .019, about 1 in 52.
Run It in Software
The code below reads the running example's data from data.csv; save it in the same folder you run the code from.
SPSS (version 30, as documented by IBM, with PROCESS 4)
- Install the PROCESS macro for SPSS (free from processmacro.org), which adds it to the Regression menu.
- Some versions of PROCESS for SPSS stop with an error on variable names longer than eight characters, so it's safest to shorten
practice_minutesfirst:RENAME VARIABLES (practice_minutes = practice). - Analyze → Regression → PROCESS.
- Move
phq9into Y Variable,practiceinto X Variable andbroodinginto Mediator(s) M. - Set Model Number to 4 and leave bootstrap samples at 5,000.
- Under Options, ask for the total effect model and effect sizes, then click OK. The syntax below also sets a seed, so the interval can be reproduced.
Or paste this syntax:
RENAME VARIABLES (practice_minutes = practice). PROCESS y=phq9 /x=practice /m=brooding /model=4 /total=1 /effsize=1 /boot=5000 /seed=20260928.
Reading the Output
PROCESS prints plain text, one regression at a time. Read it in this order: the indirect effect and its BootLLCI to BootULCI interval, then the completely standardized indirect effect, then the direct effect with its t and p, then the total effect. Paths a and b are the practice coefficient in the first model and the brooding coefficient in the second.
OUTCOME VARIABLE:
brooding
Model Summary
R R-sq MSE F df1 df2 p
.3560 .1267 7.9212 28.7320 1.0000 198.0000 .0000
Model
coeff se t p LLCI ULCI
constant 13.6744 .5372 25.4567 .0000 12.6151 14.7337
practice -.1337 .0249 -5.3602 .0000 -.1829 -.0845
OUTCOME VARIABLE:
phq9
Model Summary
R R-sq MSE F df1 df2 p
.5244 .2750 18.3263 37.3700 2.0000 197.0000 .0000
Model
coeff se t p LLCI ULCI
constant 2.6701 1.6889 1.5810 .1155 -.6606 6.0008
practice -.0957 .0406 -2.3574 .0194 -.1758 -.0156
brooding .7495 .1081 6.9335 .0000 .5363 .9627
************************** TOTAL EFFECT MODEL ****************************
OUTCOME VARIABLE:
phq9
Model Summary
R R-sq MSE F df1 df2 p
.3133 .0981 22.6834 21.5439 1.0000 198.0000 .0000
Model
coeff se t p LLCI ULCI
constant 12.9189 .9090 14.2122 .0000 11.1264 14.7115
practice -.1959 .0422 -4.6415 .0000 -.2792 -.1127
************** TOTAL, DIRECT, AND INDIRECT EFFECTS OF X ON Y **************
Total effect of X on Y
Effect se t p LLCI ULCI
-.1959 .0422 -4.6415 .0000 -.2792 -.1127
Direct effect of X on Y
Effect se t p LLCI ULCI
-.0957 .0406 -2.3574 .0194 -.1758 -.0156
Indirect effect(s) of X on Y:
Effect BootSE BootLLCI BootULCI
brooding -.1002 .0228 -.1461 -.0590
Completely standardized indirect effect(s) of X on Y:
Effect BootSE BootLLCI BootULCI
brooding -.1602 .0352 -.2314 -.0946
PROCESS draws its own resamples, so its BootSE and Boot limits will differ from these in the third or fourth decimal. The regression numbers match exactly. A p of .0000 means p < .0001; report it as p < .001. PROCESS has no p-value for the indirect effect: the interval is the test.
Output laid out from this page's computed results, not captured from a live run; labels and layout may differ slightly in your version.
R
mind <- read.csv("data.csv")
# Path a, then paths b and c′, then the total effect c
fit_a <- lm(brooding ~ practice_minutes, data = mind)
fit_y <- lm(phq9 ~ practice_minutes + brooding, data = mind)
fit_c <- lm(phq9 ~ practice_minutes, data = mind)
a <- coef(fit_a)["practice_minutes"] # -0.1337209
b <- coef(fit_y)["brooding"] # 0.7494866
cp <- coef(fit_y)["practice_minutes"] # -0.0957239
a * b # -0.100222
coef(fit_c)["practice_minutes"] # -0.1959459 (= cp + a * b)
summary(fit_y)$coefficients # t and p for c′: -2.357, 0.0194
# Percentile bootstrap for ab: resample whole rows, refit, repeat
set.seed(20260928)
boot_ab <- replicate(5000, {
d <- mind[sample(nrow(mind), replace = TRUE), ]
coef(lm(brooding ~ practice_minutes, data = d))[2] *
coef(lm(phq9 ~ practice_minutes + brooding, data = d))[3]
})
quantile(boot_ab, c(.025, .975)) # -0.1476 and -0.0585 with this seed
practice_minutes
-0.100222
practice_minutes
-0.1959459
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.6701255 1.68893031 1.580957 1.154922e-01
practice_minutes -0.0957239 0.04060519 -2.357430 1.938252e-02
brooding 0.7494866 0.10809572 6.933545 5.733998e-11
2.5% 97.5%
-0.14756680 -0.05845222
The first value is ab (R keeps the name of a's coefficient), then the total effect c. The coefficients are exact for these data. R's random numbers differ from the generator this page used, so the bootstrap limits land close to, but not exactly on, the page's −0.146 and −0.059: with the seed above, −0.148 and −0.058. Other seeds move them by about 0.002. The mediation and lavaan packages, and the R version of PROCESS, do the same analysis with more output.
Output from a real run: R 4.6.1, run 2026-10-03.
Python
import pandas as pd
import pingouin as pg
mind = pd.read_csv("data.csv")
pg.mediation_analysis(data=mind, x="practice_minutes", m="brooding",
y="phq9", n_boot=5000, seed=42)
path coef se pval CI[2.5%] CI[97.5%] sig
0 brooding ~ X -0.133721 0.024947 2.300703e-07 -0.182917 -0.084525 Yes
1 Y ~ brooding 0.840200 0.102171 2.576747e-14 0.638718 1.041683 Yes
2 Total -0.195946 0.042216 6.285098e-06 -0.279196 -0.112696 Yes
3 Direct -0.095724 0.040605 1.938252e-02 -0.175801 -0.015647 Yes
4 Indirect -0.100222 0.022888 0.000000e+00 -0.150800 -0.060920 Yes
Read Indirect first (−0.100, interval −0.151 to −0.061), then Direct and Total. Two differences from the page: pingouin's interval is bias-corrected rather than percentile, so it sits a little lower (−0.151 to −0.061 against −0.146 to −0.059), and its Y ~ brooding row is brooding's slope without practice held constant (0.840), not path b (0.749). For b, fit statsmodels.formula.api.ols("phq9 ~ practice_minutes + brooding", mind).
Output from a real run: Python 3.9.6 (pingouin 0.5.5, pandas 2.3.3), run 2026-10-03.
Impact
Effect Size
The indirect effect, ab, is already an effect size in the outcome's own units: PHQ-9 points per minute of daily practice. To compare it with studies that used other scales, divide out the units. The completely standardized indirect effect says how many standard deviations lower (or higher) the outcome is predicted to be, along the proposed route through the mediator, for people one standard deviation apart on the predictor.
People 8 minutes a day above average in practice scored 0.16 standard deviations lower on the PHQ-9 along the proposed route through brooding, about 0.8 points.
Researchers also report the proportion mediated, ab ÷ c: here −0.100 ÷ −0.196 = .51, about half of practice's total link with symptoms. Read it loosely. It's a ratio of two estimates, so it swings widely when the total effect is small, it passes 1 or turns negative when the direct and indirect effects point in opposite directions, and cross-sectional estimates of it can be badly misleading (Maxwell & Cole, 2007).
In practical terms, people who practiced 10 minutes a day more had about 2 fewer PHQ-9 points overall, about 1 of them along the proposed route through brooding. Whether a 1-point difference on the PHQ-9 matters clinically is a clinical question, and whether adding 10 minutes of practice would produce it needs an experiment.
There are no agreed benchmarks for this effect size, so judge it against other studies of the same mediator rather than against labels like small or large.
Statistical Significance
The indirect effect has no p-value of its own in a percentile bootstrap. Its test is the interval: if the 95% bootstrap interval for ab excludes zero, the indirect effect is statistically significant at α = .05. The individual paths (a, b, c′ and c) are ordinary regression slopes, and each has a t test and a p-value that answers the usual question: if that slope were zero in the population, how often would a sample give one at least this far from zero?
The indirect effect's interval, −0.146 to −0.059, lies entirely below zero, so it's significant. The direct effect's p = .019 says that if practice had no link with symptoms beyond brooding, a c′ at least this far from zero, in either direction, would turn up about 2% of the time.
Earlier practice, following Baron and Kenny (1986), was to test each path in turn and infer mediation from the pattern of significant results. That approach has been replaced by estimating and testing ab directly, which has more power and gives the indirect effect a size and an interval (Preacher & Hayes, 2008).
Neither the interval nor p is the probability that brooding is the mechanism, and neither says how large or important the effect is. That's what ab, its interval and the standardized effect are for.
Benchmarks p at a Glance
Strength of evidence against the null hypothesis.
Power and Sample Size
Power is the chance that a study detects an effect that's really there. For mediation, it depends mostly on the smaller of the two paths, a and b: the product is only as detectable as its weaker link. It also depends on the sample size, α and the test used. The bootstrap test of ab has far more power than the causal-steps approach, which first requires a significant total effect, especially when the direct effect is near zero.
Suppose, before collecting data, we expected practice to relate to brooding, and brooding to symptoms, at a medium standardized size of about .39 each. Fritz and MacKinnon's (2007) simulations put the sample needed for 80% power with a percentile bootstrap at 78 people. Our 200 comfortably exceed that; our estimated paths, about −.36 and .45 in standardized terms, are in that range.
Researchers usually aim for at least 80% power. Plan it before collecting data, using the smallest paths that would matter. Small paths need big samples: with both paths small (.14), the percentile bootstrap needs about 558 people for 80% power, and the old causal-steps test, when there's no direct effect, needs 20,886 (Fritz & MacKinnon, 2007). There's no calculator for mediation on this page; use Fritz and MacKinnon's table, or a simulation-based tool, to plan.
Other Info
Follow-Up and Post Hoc Tests
None needed. This test answers a single question, so there are no planned contrasts or post hoc tests to run.
References
- 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
-
Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and resampling strategies for assessing and comparing indirect effects in multiple mediator models. Behavior Research Methods, 40(3), 879–891.
https://doi.org/10.3758/BRM.40.3.879
“the causal steps strategy cannot be recommended except in large samples” (p. 880)
“Mediation exists when a predictor affects a dependent variable indirectly through at least one intervening variable, or mediator.” (Abstract)
“The total effect of X on Y can be expressed as the sum of the direct and indirect effects” (p. 880)
“percentile bootstrap CIs can be asymmetrical because they are based on an empirical estimation of the sampling distribution of the indirect effect, rather than on an assumption that the sampling distribution is normal” (p. 883)
“We recommend at least 5,000 resamples for final reporting, although 1,000 is probably sufficient for preliminary analyses.” (p. 889, note 5)
-
Maxwell, S. E., & Cole, D. A. (2007). Bias in cross-sectional analyses of longitudinal mediation. Psychological Methods, 12(1), 23–44.
https://doi.org/10.1037/1082-989X.12.1.23
“cross-sectional approaches to mediation typically generate substantially biased estimates of longitudinal parameters even under the ideal conditions when mediation is complete” (Abstract)
“Most empirical tests of mediation utilize cross-sectional data despite the fact that mediation consists of causal processes that unfold over time.” (Abstract)
-
Fritz, M. S., & MacKinnon, D. P. (2007). Required sample size to detect the mediated effect. Psychological Science, 18(3), 233–239.
https://doi.org/10.1111/j.1467-9280.2007.01882.x
“Mediation is said to occur if this confidence interval does not contain zero.” (Method, Percentile Bootstrap)
- Efron, B. (1979). Bootstrap methods: Another look at the jackknife. The Annals of Statistics, 7(1), 1–26. https://doi.org/10.1214/aos/1176344552
-
Muff, S., Nilsen, E. B., O'Hara, R. B., & Nater, C. R. (2022). Rewriting results sections in the language of evidence. Trends in Ecology & Evolution, 37(3), 203–210.
https://doi.org/10.1016/j.tree.2021.10.009
“we suggest language of evidence that allows for a more nuanced approach to communicate scientific findings as a simple and intuitive alternative to statistical significance testing” (Abstract)
-
Williams, M. N., Gómez Grajales, C. A., & Kurkiewicz, D. (2013). Assumptions of multiple regression: Correcting two misconceptions. Practical Assessment, Research & Evaluation, 18(11), 1–14.
https://doi.org/10.7275/55hn-wk47
“ordinary least squares estimates will be unbiased and consistent as long as the errors are independent, but will not be efficient” (p. 9)
- Hayes, A. F., & Cai, L. (2007). Using heteroskedasticity-consistent standard error estimators in OLS regression: An introduction and software implementation. Behavior Research Methods, 39(4), 709–722. https://doi.org/10.3758/BF03192961
Spot an error? Something still confusing? Tell us at support@statsforpsychology.com.