Public preview: This page shows the analysis output, figures, and reporting guidance. It does not include the underlying R code. The paid version includes the complete editable R Markdown source, all analysis code, synthetic data, and reusable output files.

Purpose

This workflow separates three related questions:

  1. Mediation: Is the association between a predictor and an outcome statistically carried through a proposed mediator?
  2. Moderation: Does the association between a predictor and an outcome differ across levels of a moderator?
  3. Conditional process: Does an indirect effect vary across levels of a moderator?

The worked example examines whether dissertation-role ambiguity is associated with dissertation progress through research self-efficacy, and whether advisor support changes these associations.

The included data are entirely synthetic. The models estimate conditional associations. A significant indirect effect does not establish a causal mechanism, especially with cross-sectional data. Temporal ordering, confounding, measurement quality, and the research design must support any causal interpretation.

Analysis map

Question Model Focal quantity
Is ambiguity related to progress through self-efficacy? Simple mediation Bootstrap indirect effect, \(ab\)
Does advisor support change the ambiguity–progress association? Moderation Interaction, simple slopes, Johnson–Neyman region
Does the indirect association vary with advisor support? First-stage moderated mediation Conditional indirect effects and index of moderated mediation

These models assume continuous variables and linear relations. Binary, ordinal, count, multilevel, latent-variable, and longitudinal outcomes need extensions appropriate to their measurement and dependence structure.

`n

When adapting this workflow, define the predictor, mediator, moderator, and outcome from theory before inspecting significance. Preserve an untouched source file and work only with de-identified data.

`n

Data audit

Analysis flow

stage n
Imported records 520
Complete cases 491
Excluded for missing analysis values 29
variable missing_n missing_percent
student_id 0 0.0
stage 0 0.0
hours_employed 0 0.0
caregiving 0 0.0
role_ambiguity 0 0.0
advisor_support 9 1.7
research_self_efficacy 12 2.3
dissertation_progress 8 1.5

Complete-case analysis is used only to keep this synthetic example focused. For real studies, examine why data are missing and consider multiple imputation or another design-appropriate method rather than treating complete cases as a default.

Distributions and observed ranges

variable n mean sd min max
role_ambiguity 491 49.87 9.98 24.5 80.0
research_self_efficacy 491 68.50 9.06 41.4 92.5
advisor_support 491 55.54 10.57 22.0 84.4
dissertation_progress 491 55.89 11.13 24.1 83.3

Associations and model support

role_ambiguity research_self_efficacy advisor_support dissertation_progress
role_ambiguity 1.00 -0.57 -0.09 -0.42
research_self_efficacy -0.57 1.00 0.27 0.67
advisor_support -0.09 0.27 1.00 0.30
dissertation_progress -0.42 0.67 0.30 1.00

Inspect scatterplots, measurement quality, influential cases, and the plausibility of linear effects. Centering changes the meaning of lower-order coefficients but does not repair a misspecified functional form.

Simple mediation

The mediator model estimates path \(a\). The outcome model estimates path \(b\) and the direct association \(c'\). The total-effect model estimates \(c\). The indirect effect is \(ab\).

effect estimate
a: ambiguity <U+2192> self-efficacy -0.527
b: self-efficacy <U+2192> progress 0.649
c’: direct association -0.147
c: total association -0.489
ab: indirect association -0.342

Bootstrap the indirect effect

The product \(ab\) is often asymmetric, so this workflow uses a nonparametric percentile bootstrap rather than a normal-theory test of the indirect effect.

effect estimate conf_low conf_high
Indirect (ab) -0.342 -0.410 -0.280
Direct (c’) -0.147 -0.234 -0.060
Total (c) -0.489 -0.569 -0.407

Do not decide that mediation is “partial” or “complete” from the significance of the direct effect. Report the indirect, direct, and total estimates with uncertainty and interpret them in relation to theory and design.

Moderation

The moderation model asks whether the ambiguity–progress slope changes across advisor support. Heteroskedasticity-consistent HC3 standard errors are used for coefficient inference.

term estimate std_error statistic p_value conf_low conf_high
(Intercept) 53.750 1.092 49.214 0.000 51.604 55.896
ambiguity_c -0.434 0.037 -11.774 0.000 -0.506 -0.361
support_c 0.300 0.034 8.775 0.000 0.233 0.367
stageData analysis 6.397 0.947 6.757 0.000 4.537 8.258
stageWriting 11.406 0.895 12.739 0.000 9.647 13.166
hours_employed -0.132 0.034 -3.918 0.000 -0.198 -0.066
caregivingYes -1.982 0.800 -2.477 0.014 -3.553 -0.410
ambiguity_c:support_c 0.020 0.004 5.496 0.000 0.013 0.027

Interaction plot

Simple slopes

support_level support_c estimate std_error conf_low conf_high p_value
Lower support (<U+2212>1 SD) -10.575 -0.645 0.052 -0.747 -0.542 0
Average support 0.000 -0.434 0.037 -0.506 -0.361 0
Higher support (+1 SD) 10.575 -0.223 0.054 -0.329 -0.116 0

Johnson–Neyman region

The Johnson–Neyman calculation identifies moderator values where the conditional ambiguity slope changes statistical status. It is a continuous probing tool, not a data-driven cutoff for categorizing people.

boundary_centered advisor_support
15.1 70.64

Interpret Johnson–Neyman boundaries only inside the observed moderator range. Sparse data near a boundary, multiple testing, functional-form errors, and influential observations can make a precise-looking cutoff misleading.

Conditional process analysis

The first-stage moderated-mediation model allows advisor support to moderate path \(a\), from role ambiguity to self-efficacy. The outcome model also retains the ambiguity-by-support interaction so the conditional direct association is not forced to be constant.

model term estimate std.error conf.low conf.high p.value
Mediator: self-efficacy ambiguity_c -0.488 0.031 -0.548 -0.428 0
Mediator: self-efficacy support_c 0.198 0.029 0.142 0.254 0
Mediator: self-efficacy ambiguity_c:support_c 0.015 0.003 0.010 0.020 0
Outcome: progress ambiguity_c -0.177 0.042 -0.259 -0.095 0
Outcome: progress support_c 0.196 0.033 0.130 0.261 0
Outcome: progress self_efficacy_c 0.526 0.050 0.427 0.625 0
Outcome: progress ambiguity_c:support_c 0.012 0.003 0.006 0.018 0

Bootstrap conditional indirect effects

support_level support_c indirect direct total indirect_low indirect_high direct_low direct_high total_low total_high
Lower support (<U+2212>1 SD) -10.575 -0.340 -0.305 -0.645 -0.416 -0.273 -0.418 -0.199 -0.747 -0.550
Average support 0.000 -0.257 -0.177 -0.434 -0.315 -0.205 -0.263 -0.093 -0.506 -0.360
Higher support (+1 SD) 10.575 -0.173 -0.049 -0.223 -0.234 -0.122 -0.148 0.048 -0.327 -0.119
effect estimate conf_low conf_high
Index of moderated mediation 0.008 0.005 0.011

The index of moderated mediation summarizes how much the indirect effect changes for a one-unit increase in centered advisor support. Evidence that a conditional indirect effect differs from zero at one selected support value but not another is not, by itself, evidence that the two indirect effects differ. The index and its bootstrap confidence interval address that comparison directly.

Conditional indirect-effect plot

Diagnostics and sensitivity checks

Residual patterns

Heteroskedasticity and influence

model breusch_pagan_p cases_above_cooks_4_over_n largest_cooks_distance
Mediator 0.369 24 0.021
Outcome 0.906 27 0.051

A diagnostic flag is a prompt to inspect data, design, and model form; it is not an automatic reason to remove observations. If heteroskedasticity is present, report robust inference or justify an alternative. If influential cases are valid, compare conclusions with and without them and disclose material changes.

Alternative covariate specification

specification path_a_at_mean path_b index_modmed
Adjusted primary model -0.488 0.526 0.008
Unadjusted sensitivity model -0.481 0.700 0.010

Covariates should be selected from design and substantive knowledge, not from automated significance screening. Adjusting for a descendant of the predictor or mediator can introduce bias.

Dynamic results narrative

A conditional-process analysis was conducted with 491 complete synthetic records. Role ambiguity was associated with research self-efficacy (path a = -0.53), and self-efficacy was associated with dissertation progress while controlling for role ambiguity and prespecified covariates (path b = 0.65). The estimated indirect association was -0.34, bootstrap 95% CI [-0.41, -0.28]; this interval did not include zero. The direct association was -0.15, bootstrap 95% CI [-0.23, -0.06.

Advisor support moderated the association between role ambiguity and dissertation progress, interaction estimate = 0.02, HC3 95% CI [0.01, 0.03], p < .001. The conditional ambiguity slope was -0.64 at lower support, -0.43 at average support, and -0.22 at higher support. These slopes are model-based comparisons at selected moderator values and should be read with the interaction plot and observed moderator range.

In the first-stage moderated-mediation model, the indirect association through self-efficacy was -0.34, bootstrap 95% CI [-0.42, -0.27] at lower support; -0.26, 95% CI [-0.31, -0.21] at average support; and -0.17, 95% CI [-0.23, -0.12] at higher support. The index of moderated mediation was 0.008, bootstrap 95% CI [0.005, 0.011]; this interval did not include zero. Because the data are cross-sectional and synthetic, these estimates demonstrate conditional associations rather than a verified causal process.

Reporting checklist

  • Define the predictor, mediator, moderator, outcome, covariates, and their measurement occasions.
  • State the theoretical temporal order and why it is credible for the design.
  • Describe coding, centering, reference groups, missing-data treatment, and analysis sample.
  • Report the component paths and indirect effect with bootstrap confidence intervals.
  • Report the interaction before interpreting simple slopes.
  • Identify the exact moderator values used for probing and whether they are observed in the data.
  • Report Johnson–Neyman boundaries only within the observed moderator range.
  • For moderated mediation, report conditional indirect effects and the index of moderated mediation.
  • Document diagnostics, robust standard errors, sensitivity analyses, and influential-case review.
  • Limit conclusions to the design; cross-sectional indirect effects do not establish temporal or causal mediation.

Planning guidance

Power for an indirect or conditional indirect effect depends on several paths, measurement reliability, predictor distributions, missingness, and model complexity. A single regression rule of thumb is not adequate. Plan with simulation using plausible path sizes and the intended sampling design, and allow for incomplete records. Confirm the final plan with the dissertation advisor, committee, or a qualified methodologist.

Exports

file
synthetic_conditional_process.csv
simple_mediation_effects.csv
moderation_coefficients_hc3.csv
moderation_simple_slopes.csv
conditional_effects.csv
index_of_moderated_mediation.csv
diagnostic_summary.csv

References

  • Hayes, A. F. (2022). Introduction to Mediation, Moderation, and Conditional Process Analysis: A Regression-Based Approach (3rd ed.). Guilford Press.
  • MacKinnon, D. P. (2008). Introduction to Statistical Mediation Analysis. Routledge.
  • Preacher, K. J., Rucker, D. D., & Hayes, A. F. (2007). Addressing moderated mediation hypotheses: Theory, methods, and prescriptions. Multivariate Behavioral Research, 42(1), 185–227.
  • VanderWeele, T. J. (2015). Explanation in Causal Inference: Methods for Mediation and Interaction. Oxford University Press.

`n