Path analysis and mediation
Several regression equations in one model: X affects M, and M affects Y – path analysis estimates them all together by maximum likelihood, tests how well the whole model fits the data, and decomposes each effect into direct, indirect and total. The output: fit indices (χ², CFI, TLI, RMSEA, SRMR, AIC, BIC), path coefficients with β, R² for each predicted variable, indirect effects with delta-method and bootstrap confidence intervals, a path diagram and a results paragraph in English.
Loading the data
Paste columns directly from the sheet (including the header row) – select them in Excel, copy, and paste here:
Model specification
When to use?
When the question is not "does X predict Y" but "through what": X affects M, and M affects Y. Field (2024, section 11.4.1) defines mediation as a situation in which "the relationship between a predictor variable and an outcome variable can be explained by their relationship to a third variable, the mediator": the total effect of X on Y decomposes into a direct effect (c) and an indirect effect through the mediator (paths a and b). His example (Lambert et al., 2012): pornography consumption → reduced relationship commitment → infidelity – "it is unlikely that everyone who watches pornography immediately runs off to be unfaithful; presumably it leads to some emotional or cognitive change" that is the mechanism. Path analysis is the generalization: several predicted variables, several mediators (Field, section 11.4.7 – two mediators in parallel), longer chains, and predictors that affect some of the variables and not others – all the equations are estimated together, and the whole model is tested against the data. It is the special case of structural equation modeling (SEM) in which all the variables are observed: Pallant (2020, chapter 10) describes SEM as a technique "based on multiple regression and factor analysis, which allows you to assess the importance of each of the independent variables in the model, to test the overall fit of the model to the data, and to compare alternative models" – and adds that SPSS itself does not include it (AMOS is required).
A single equation – the Linear regression page (the same coefficients, with residual diagnostics); a relationship between two variables without direction – the Correlations page; a dichotomous predicted variable – Logistic regression (path analysis assumes quantitative predicted variables); latent factors – Confirmatory factor analysis (the measurement model) and Structural equation modeling (paths between latent factors) and Latent mediation (bootstrap as in lavaan); non-recursive models (reciprocal effects) – not on the page; moderation (interaction; Field, section 11.3), PROCESS-style mediation and moderated mediation – the Moderation and mediation page. A multi-item scale score (the Cronbach's alpha and scale score page) is treated as an interval variable under the site convention (the Variables and levels of measurement page); a single Likert item – is not.
The logic: from the model to the covariance matrix and back
The model is a series of regression equations. Field (2024, section 11.4.2): "the letters that label the paths represent the unstandardized coefficients" – path a is the B of X in the equation for M, paths b and c are the Bs of M and of X in the equation for Y. Historically (Baron & Kenny, 1986, in Field) they were estimated in three separate regressions; path analysis estimates them all at once by maximum likelihood (ML), in the configuration of the lavaan package in R: in a recursive model (without cycles) the estimates are identical to those of ordinary regression for each equation, and the standard errors are slightly smaller (divisor N instead of N − k − 1). The indirect effect is the product of the coefficients along the path, ab (Field, Equation 11.6); the total – c + ab. On this page, with several indirect paths between a pair of variables, the indirect effect is the sum of the products over all the paths, and the total effect is computed from the matrix (I − A)−1 of all the paths.
What χ² tests. From the model (the coefficients and the error variances) one can compute which covariance matrix it "expects" to see among all the variables; it is compared with the matrix actually observed. χ² measures the gap, and the degrees of freedom are the number of variances and covariances in the data minus the number of parameters the model estimates. A model in which every possible arrow exists (for example simple mediation X → M → Y with a direct path) is saturated: df = 0, a perfect fit by definition, and there is nothing to test except the coefficients. Only when the model omits a relationship (for example: no direct path from "group" to "daily_use" in the sample file) are there degrees of freedom, and χ² tests whether the omission is consistent with the data – here a p larger than .05 is the desired result. The other fit indices (CFI, TLI, RMSEA, SRMR) translate the same gap into scales that depend less on sample size, and AIC and BIC are used to compare alternative models on the same data (American Psychological Association [APA], 2020, Table 7.19 – a model comparison table with χ², RMSEA, AIC and BIC). The page computes all of these exactly as lavaan does (identical to the sixth digit in the indices, the coefficients, the standard errors and the defined effects).
How to read the output?
Table 1 – fit. First df: if 0 – the model is saturated and Table 1 contains no information. Otherwise: χ² with p (you want nonsignificant), then the indices following Hu and Bentler (1999, p. 27): a value "close to .95" for CFI and TLI, "close to .06" for RMSEA and "close to .08" for SRMR indicate a relatively good fit; Brown (2015, pp. 74-75) adds the accepted ranges – CFI and TLI between .90 and .95 (Bentler, 1990, as cited there), RMSEA up to .08 (Browne & Cudeck, 1993, as cited there) – and stresses that the "close to" is not accidental: the thresholds varied with the conditions of the model. Hu and Bentler's simulations were run on models with latent variables, so in a path model of observed variables the thresholds are an approximation. Cells outside the accepted range are shaded. χ² is sensitive to sample size: in a large sample every small gap comes out significant, and in a small sample the test has no power – so read all the indices together, and the "Interpreting the result" box says whether they agree.
Table 2 – path coefficients. For each arrow: B (the unstandardized – "the change in the outcome for each unit of the predictor, holding the others constant"; Field, 2024, section 9.11.3), the standard error, z and p (ML estimation – the normal distribution, not t), a 95% confidence interval, and the standardized β for comparison across paths and across studies. Field (section 11.4.5) reads the output path by path: "pornography consumption significantly predicts commitment, B = −0.47, 95% CI [−0.94, −0.00], p = .048; the negative sign tells us that as consumption increases, commitment decreases".
Table 3 – R² and error variance for each predicted variable: how much of its variance its equation explains (Field reports in his example 2% for commitment and 11.4% for infidelity).
Table 4 – the effects. For each pair with an indirect path between them: the direct effect, the indirect effect (ab) with the delta-method standard error (Sobel test) and p, a delta confidence interval, a bootstrap confidence interval, the total effect with a bootstrap interval, and the index of mediation. Which interval should be read? Here the sources agree: Field (sections 11.4.2 and 11.4.6) – "I have repeatedly favored bootstrap confidence intervals, so report those"; the reason: the distribution of the product ab is neither normal nor symmetric, and the symmetric delta interval is less accurate in small samples. The decision: a bootstrap interval that does not include zero – "we tend to conclude that mediation has occurred" (Field, Sam's tips). The bootstrap on the page is seeded (the same seed – the same interval on every run, on every computer; change the seed to see how much the interval itself varies), and the generator is R's generator: seed 2026 on the page and iseed = 2026 in lavaan give the same samples and the same percentile interval (R guide below); Hayes's PROCESS prints a BCa (bias-corrected) interval by default, close but not identical.
The path diagram – the standardized coefficients on the arrows, a dashed arrow for a nonsignificant path; Field (section 11.4.6, Figure 11.12) recommends presenting the model this way in the report. The results paragraph – the fit, the paths, the indirect effects and R², in English. The "Interpreting the result" box – do the indices agree?, the ratio of participants to parameters, delta vs. bootstrap, partial/full mediation and inconsistent mediation, and a reminder that the model comes before the data.
Effect size
Field (2024, section 11.4.3): "the simplest is to look at the B for the indirect effect and its confidence interval" – ab is a regression coefficient in every respect, in the units of the predicted variable. To compare across studies, standardize: the partially standardized indirect effect – ab divided by the standard deviation of the predicted variable (MacKinnon, 2008, in Field, Equation 11.7), and the index of mediation (index of mediation) – also multiplied by the standard deviation of the predictor (Preacher & Hayes, 2008, in Field, Equation 11.8), that is, the completely standardized indirect effect; Field reports it in his example: "0.04 – very small". Table 4 prints the index of mediation, and the reading box also the partially standardized one. For each equation R² is the overall effect size (Cohen's yardstick, 1988, pp. 413-414: .02 / .13 / .26), and the β of each path – the effect size of the individual path. The ratio "indirect divided by total" (PM) is not printed: it is not bounded to 0-1 and explodes when the total effect is small (inconsistent mediation).
Assumptions and warnings
The model comes before the data. The arrangement of the arrows is determined by theory – not by the software and not by the fit. Field (2024, section 11.4.1) phrases the conditions for mediation as a priori hypotheses ("for the hypothesis to be true: (1)… (4)…"); path analysis tests whether a given model is consistent with the data, not whether it is correct – alternative models (reversed arrows, an unmeasured mediator) may fit equally well, and Pallant (2020, chapter 10) notes that SEM "allows you to compare alternative models". A model modified after looking at the results (an arrow added "to make it fit") is an exploratory analysis and is reported as such.
Recursiveness. The page supports models without cycles (DAG): a variable cannot affect itself, directly or through others. The reciprocal effects of non-recursive models require instrumental variables – not on the page.
The regression assumptions for each equation (Field, Section 9.4.1): linearity and additivity, independence of the residuals, equality of variances and normality. ML estimation assumes multivariate normality of the predicted variables; its violation biases χ² and the standard errors. Checking the residuals of each equation – on the Linear regression page (the diagnostics table and the ZRESID plot), and of the variables themselves – on the Outliers and assumptions page. Field (section 11.4.4) suggests heteroscedasticity-robust standard errors (HC4) in PROCESS – not on the page.
Sample size. An old rule of thumb: ten participants for each estimated parameter (paths and error variances); the page warns below it. Pallant's regression rules (2020, chapter 13: N > 50 + 8m, 15 per predictor) apply to each equation separately. Field (section 11.4.7) notes that with a huge sample (947) "there is no value in bootstrapping" – and in a small sample it is especially important.
Variable types. Predicted variables quantitative and continuous; predictors quantitative or dichotomous (group 1/2 – the B from it is the difference between the means); a categorical variable with three or more levels requires dummy coding (Field, Section 9.4.1), which is not on the page; an ordinal variable enters as a number with caution. Missing values – listwise deletion on all the model variables (the page reports how many were dropped); FIML, the accepted method for missing data in SEM, is not on the page – see the Missing values page. The exogenous variables are treated as fixed (fixed.x, as in the lavaan default): their variances and covariances are taken from the sample and are not estimated or counted as parameters.
Inconsistent mediation. When the direct and indirect effects have opposite signs the total effect is smaller than both – and the simple correlation between X and Y can be zero despite real mediation. This is why Field (section 11.4.2) rejects Baron and Kenny's first condition ("X must predict Y first") as a necessary condition; the reading box flags such a situation. "Full mediation" and "partial" – the language of Baron and Kenny: if the direct path is not significant alongside the indirect one, "full". Field warns against "black-and-white thinking": a p that moves from .049 to .051 is not a change, and a B that drops from .46 to .18 is a change even if both are significant – report the size of the indirect effect and its confidence interval.
What this page does not compute. Latent factors and CFA, non-recursive models, model comparison (Δχ²) and multigroup models, modification indices, FIML for missing data, robust standard errors (MLR, HC4), BCa bootstrap intervals, automatic dummy variables, moderation and moderated mediation (Field, Section 11.3), PM and κ² (Preacher & Kelley, 2011, in Field).
And how do you do it in SPSS?
SPSS has no path analysis: Pallant (2020, chapter 10) – "IBM SPSS Statistics does not have a module for structural equation modeling, but it supports the AMOS add-on". Two common ways: (1) AMOS – draw the model and get the same tables (ML estimates, fit indices, direct/indirect/total effects, bootstrap); (2) PROCESS by Hayes (a free add-on) for mediation and moderation models – Field's way (2024, sections 11.4.4-11.4.5): Analyze › Regression › PROCESS, the predicted variable into Y, the predictor into X, the mediator (or several) into Mediator(s) M, model 4, Bootstrap inference for model coefficients, and under options Effect size and Total effect model; the output – text: the equation for M (path a), the equation for Y (b and c), the total effect, and "Indirect effect of X on Y" with a bootstrap interval (BCa) and the index of mediation. PROCESS is limited to its model templates (mediators in parallel, not a long chain and not several predicted variables); a general model – AMOS or lavaan.
The syntax the page generates runs the model equations as separate regressions in SPSS (Baron and Kenny's way, Field, section 11.4.2), after a SELECT IF that reproduces the listwise deletion: B, Beta and R Square are identical to Tables 2-3; the standard errors, t and p differ slightly (OLS vs. ML); the fit indices and the indirect effects are not produced – for those, PROCESS or AMOS. For the example model:
SELECT IF (NOT MISSING(age) AND NOT MISSING(group) AND NOT MISSING(attitude_score) AND NOT MISSING(daily_use)). EXECUTE. REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS CI(95) R ANOVA /NOORIGIN /DEPENDENT attitude_score /METHOD=ENTER group age. REGRESSION /MISSING LISTWISE /STATISTICS COEFF OUTS CI(95) R ANOVA /NOORIGIN /DEPENDENT daily_use /METHOD=ENTER attitude_score age.
And how do you do it in R?
The lavaan package is the standard: write the model as equations (~ for regression), give labels to the paths and define indirect and total effects with :=; sem() estimates by ML with fixed.x = TRUE (the default – exactly the page's configuration), summary(fit.measures = TRUE, standardized = TRUE) gives Tables 1-4 (the Std.all column = β), and se = "bootstrap" with parameterEstimates(boot.ci.type = "perc") – bootstrap intervals; with iseed equal to the page's seed – the same samples and the same intervals as on the page. The script was run as is on the sample data file and gave the table values (in the comments). The site rule for Hebrew in R: a UTF-8 file, every comment line starts with an English word, short English names for the formula, and a UTF-8 locale for Hebrew names (on Windows: R 4.2 or later, or Sys.setlocale('LC_ALL', 'Hebrew')).
# Path analysis – Professor Stat. This file is saved as UTF-8; every comment line starts with an English word
library(readxl) # Reading Excel
library(lavaan) # Structural equation models: sem, parameterEstimates, fitMeasures
# Loading: the standard template – row = participant, column = variable; the sheet "data"
d <- read_excel("C:/Rdata/DATA_path_example_eng.xlsx", sheet = "data")
d <- d[, c("group", "age", "attitude_score", "daily_use")]
names(d) <- c("grp", "age", "att", "use") # Short English names for the model formula
d <- d[complete.cases(d), ] # Listwise deletion (113 of 120)
# Model: group and age -> attitudes (a1, a2); attitudes and age -> use (b, c); indirect and total effects with :=
model <- "
att ~ a1*grp + a2*age
use ~ b*att + c*age
ind_grp := a1*b
ind_age := a2*b
tot_age := c + a2*b
"
fit <- sem(model, data = d) # ML, fixed.x = TRUE – as on the page
summary(fit, fit.measures = TRUE, standardized = TRUE, rsquare = TRUE) # χ²(1) = 1.948, p = .163; CFI .989, TLI .944, RMSEA .092 [.000, .286], SRMR .029; a1 −0.420 (p = .002), a2 0.012 (.022), b 1.446 (< .001), c −0.026 (.002); Std.all −.279, .202, .703, −.211; R² .121, .477; ind_grp −0.607 (SE 0.201, p = .003), ind_age 0.017 (.025), tot_age −0.008 (.459)
# Table 1 – fit indices only
fitMeasures(fit, c("chisq", "df", "pvalue", "cfi", "tli", "rmsea", "rmsea.ci.lower", "rmsea.ci.upper", "srmr", "aic", "bic")) # 1.948, 1, .163, .989, .944, .092, .000, .286, .029, 600.155, 616.519
# Table 4 – percentile bootstrap intervals for the defined effects (1000 samples); iseed = the page's seed – same samples, same intervals
fitb <- sem(model, data = d, se = "bootstrap", bootstrap = 1000, iseed = 2026)
pe <- parameterEstimates(fitb, boot.ci.type = "perc")
pe[pe$op == ":=", c("label", "est", "se", "ci.lower", "ci.upper")] # ind_grp −0.607 [−1.082, −0.208]; ind_age 0.017 [0.000, 0.034] (the lower bound is −0.0004 – the interval includes zero); tot_age −0.008 [−0.031, 0.014] – as on the page
Reporting the results
Report the estimation method and the software, N, the fit (χ² with df and p, CFI, TLI, RMSEA with its confidence interval, SRMR), then the paths (B with a standard error or confidence interval, β, p) and the indirect effects with the bootstrap interval and the effect size – and instead of a long list, a diagram with the coefficients (APA, 2020, section 6.43: "report sufficient information for the reader to corroborate the analyses"; section 6.44: define the abbreviations CFI, RMSEA, SEM at their first appearance, unlike the standard statistical symbols). Field's example (2024, section 11.4.6): "there was a significant indirect effect of pornography consumption on infidelity through relationship commitment, b = 0.13, 95% BCa CI [0.02, 0.27]. The effect was tiny, index of mediation 0.04" – and alongside it a figure of the model with the coefficients on the arrows and the indirect effect with its confidence interval (Figure 11.12). For alternative models – a comparison table like APA Table 7.19 (χ², df, p, RMSEA with its confidence interval, AIC, BIC and ΔAIC/ΔBIC), and for a measurement model – like Table 7.21 (NFI, CFI, RMSEA for each model).
The formatting rules (APA, 2020, Section 6.36): B, χ², z and the confidence intervals for B with a zero before the decimal point; β, R², CFI, TLI, RMSEA, SRMR and p without (they cannot exceed 1); a confidence interval in the format 95% CI [LL, UL], and for a bootstrap interval state the type (percentile / BCa) and the number of samples. The results paragraph in the output is built this way, in English.
Common mistakes
Building the model from the data. Adding arrows until the fit is good, then reporting as if a hypothesis had been tested (Field, 2024, section 11.4.1 – the conditions are a priori hypotheses).
Reading a χ² p < .05 as "good". The opposite: the test treats the model as the null hypothesis – significance is rejection. And in a saturated model there is no test at all.
Requiring a simple correlation between X and Y as a condition for mediation. In inconsistent mediation the total effect is small or zero – Field (section 11.4.2) rejects Baron and Kenny's condition in favor of estimating the indirect effect and its confidence interval.
Inferring "full mediation" from a change in significance. "A p that moves from .049 to .051" is not a finding (Field, Section 11.4.2); report ab, the bootstrap interval and the index of mediation.
A symmetric confidence interval for an indirect effect in a small sample. The distribution of ab is skewed; Field (section 11.4.6) – "report bootstrap intervals".
Interpreting an arrow as a cause. Path analysis assumes the direction of the arrows, it does not prove it; a model with reversed arrows may fit equally well (Pallant, 2020, chapter 10 – comparing alternative models).
A large model on a small sample. Fewer than ten participants per parameter – unstable estimates and unreliable normal-theory tests; in a small sample the bootstrap is especially important (Field, Section 11.4.7).
Comparing β across different models. The standardized coefficient depends on the sample's standard deviations; for meta-analysis also report B and the index of mediation (Field, Section 11.4.3).
References
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). https://doi.org/10.1037/0000165-000
Brown, T. A. (2015). Confirmatory factor analysis for applied research (2nd ed.). Guilford Press.
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
Field, A. (2024). Discovering statistics using IBM SPSS statistics (6th ed.). SAGE.
Hu, L., & Bentler, P. M. (1999). Cutoff criteria for fit indexes in covariance structure analysis: Conventional criteria versus new alternatives. Structural Equation Modeling: A Multidisciplinary Journal, 6(1), 1-55. https://doi.org/10.1080/10705519909540118
Pallant, J. (2020). SPSS survival manual: A step by step guide to data analysis using IBM SPSS (7th ed.). Routledge.
Baron and Kenny (1986), Sobel (1982), MacKinnon (2008), Preacher and Hayes (2008), Preacher and Kelley (2011), Hayes (2022), Lambert et al. (2012) and Bronstein et al. (2019) – as cited in Field (2024); Tabachnick and Fidell (2013) – as cited in Pallant (2020). Under the site rule, the reference list includes only sources that were read in the original. Bentler (1990) and Browne and Cudeck (1993) – as cited in Brown (2015). Field (2024) and Pallant (2020) in a reflowable digital copy – cited by section and chapter; Cohen (1988) and APA (2020) – by page and section of the printed edition. The page's computation is verified against the lavaan 0.6-17 package in R.