Model equations: serial-parallel mediation
Source:vignettes/GenerateModelCP.Rmd
GenerateModelCP.RmdPurpose: definitions and equations for
CP (serial-parallel mediation). For a first analysis, start
with Choose an
analysis or Get started.
GenerateModelCP() creates the model syntax used for this
structure.
M1 predicts each remaining mediator. There are no directed connections among M2, M3, and the other downstream mediators.

Difference scores and centered averages
For mediator , and are its measurements in conditions 1 and 2. Define
The bar denotes the sample mean used for centering. The outcome
difference is
.
PrepareData() constructs these variables: diff
is not centered, whereas avg is centered.
Regression equations
The equations below show the regression part of the model without covariates or an external moderator. All mediators predict the outcome difference:
The mediator equations determine the structure:
The intercepts
and
represent direct condition effects in their respective equations; the
model syntax labels
as cp. Each
is the coefficient of a mediator difference, and
is the coefficient of its centered average. For a mediator-to-mediator
connection,
and
are the corresponding coefficients from mediator
to mediator
(syntax labels b_j_i and d_j_i).
The
coefficients capture differences between condition-specific slopes. The
average component is not itself an external moderator. Moderation by a
separate variable
requires specifying W and MP.
Indirect pathways
Every mediator has a single-mediator indirect pathway . A longer directed pathway is the product of its starting coefficient, its mediator-to-mediator coefficients and its final outcome coefficient. The centered-average coefficients remain in the fitted regressions but do not enter these indirect-effect products.
For three mediators, the complete set is:
| Mediator route to Y | Indirect effect | Result identifier |
|---|---|---|
| M1 → Y | indirect_1 |
|
| M2 → Y | indirect_2 |
|
| M3 → Y | indirect_3 |
|
| M1 → M2 → Y | indirect_1_2 |
|
| M1 → M3 → Y | indirect_1_3 |
Total effects and contrasts
Sum every complete indirect pathway to obtain the total indirect effect:
Here is the set of directed condition-to-outcome pathways through one or more mediators. To compare two such pathways, define a signed contrast:
A positive contrast means that the first indirect effect is
numerically larger; it does not necessarily have a larger absolute
magnitude. For example,
,
although
.
A contrast estimate alone does not establish a difference. Compute its
CI from the difference of the effects within each matched joint draw,
using wsmed_contrasts(); do not subtract the endpoints of
two separate CIs. See Read and export
results.
Condition-specific slopes
On the unstandardized scale, the outcome slopes in conditions 1 and 2 are
The same relation applies to each included mediator-to-mediator connection, using and . These are path coefficients, not additional indirect effects.
Standardization and moderation
GenerateModel*() constructs unstandardized model syntax.
With a fitted wsMed result, use
summary(result, standardized = TRUE) to request
standardized effects and paths, or set standardized = TRUE
in wsMed() to make that scale the reporting default.
Let , and be the marginal model-implied SDs of the mediator differences, centered averages and outcome difference. Then
Mediator-to-mediator slopes use the corresponding source and destination SDs. Intermediate scales cancel in each complete indirect-effect product, giving . With moderation, evaluate the conditional paths first: . All moderator values or groups share the same marginal endpoint scale. Continuous moderator probes retain their raw units.
Standardized CIs transform coefficients and scales jointly in each draw. Do not divide raw CI endpoints by a single fitted SD, or reconstruct condition-specific slopes as : the two standardized coefficients use different predictor scales. See Standardized effects for conditional effects, interaction coefficients and inference.