Natural Direct Effect Calculator

Model exposure, mediator, and outcome inputs for estimation. See direct contrasts, proportions, and scenario sensitivity. Create clear exports and plots for fast analytical review.

Enter Model Inputs

Use a linear mediator model and either an additive outcome model or a log-link interpretation for ratio effects.

Example Data Table

This sample shows a simple mediation pattern with one exposure, one mediator, one covariate, and a continuous outcome.

Observation Exposure (A) Mediator (M) Covariate (C) Outcome (Y)
101.81.56.4
202.02.06.9
302.12.37.1
412.71.68.4
512.92.28.9
613.02.49.4

Formula Used

The calculator follows a simple counterfactual mediation setup with one exposure, one mediator, one average covariate profile, and an optional exposure–mediator interaction.

Mediator model: M(a) = α0 + αA·a + αC·C

Outcome model: Y(a, m) = β0 + βA·a + βM·m + βAM·a·m + βC·C

Natural Direct Effect: NDE(a, a*) = Y(a, M(a*)) − Y(a*, M(a*))

Natural Indirect Effect: NIE(a, a*) = Y(a, M(a)) − Y(a, M(a*))

Total Effect: TE(a, a*) = NDE + NIE

On the additive scale, the calculator reports effect differences. On the ratio option, it treats the linear predictor as a log link, then exponentiates the direct, indirect, and total effects into ratios.

The confidence intervals use a simplified delta method with independent standard errors. That approach is practical for screening, but full studies should use covariance matrices or bootstrap intervals.

How to Use This Calculator

  1. Choose an additive difference scale or a ratio scale.
  2. Enter the reference exposure value a* and the target exposure value a.
  3. Provide mediator-model coefficients α0, αA, and αC.
  4. Provide outcome-model coefficients β0, βA, βM, βAM, and βC.
  5. Enter average covariate value C for the population profile you want to summarize.
  6. Add standard errors if you want approximate confidence intervals.
  7. Submit the form to display results above the form, review the table, and inspect the chart.
  8. Use the export buttons to save a CSV or PDF version of the pathway summary.

Practical Notes

What the direct effect means

The natural direct effect captures how the outcome changes when exposure moves from a* to a while the mediator is fixed at the level it would naturally take under the reference exposure.

Main assumptions

Interpretation requires no major unmeasured confounding for exposure–outcome, exposure–mediator, and mediator–outcome paths, plus correct model specification and consistent coding of variables.

FAQs

1. What does the natural direct effect measure?

It measures the outcome change caused by moving exposure from the reference value to the target value while holding the mediator at its natural reference level.

2. When should I choose the additive scale?

Choose the additive scale when your outcome model is linear and you want direct, indirect, and total effects reported as raw mean differences.

3. When should I choose the ratio option?

Use the ratio option when your outcome model is interpreted on a log scale, so pathway effects are easier to read as multiplicative changes.

4. Why is there an interaction term βAM?

The interaction term allows the mediator effect to depend on exposure. Without it, the mediator contribution is constant across exposure levels.

5. What is the proportion mediated?

It is the indirect effect divided by the total effect on the chosen scale. It becomes unstable when the total effect is near zero.

6. Are the confidence intervals exact?

No. They are approximate delta-method intervals using independent standard errors. Publication work should rely on bootstrap methods or full variance-covariance inputs.

7. Can I use this for multiple mediators?

Not directly. This version is designed for one mediator and one summarized covariate profile. Multiple mediators need a broader identification strategy.

8. Why do my results look unrealistic?

Unrealistic values often come from mismatched scales, incorrect coefficients, or implausible exposure ranges. Check model units, coding, and the chosen interpretation.

Related Calculators

causal impact analysisselection bias adjustmentmarginal structural modelinstrumental variable estimatornatural indirect effectcausal risk ratio

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.