- Introduced by
- Bayesian framework applied to moderation by Kruschke, Gelman and colleagues
- Year
- 2000s–2010s
- Type
- Interaction / moderator test
- Family
- Multivariate analysis
What does it do?
Bayesian moderation analysis tests whether the association between a predictor X and an outcome Y depends on a third variable W, the moderator.
It fits a linear model with an interaction term, as in classical moderated regression, but places prior distributions on all coefficients and reports the posterior distribution of the interaction coefficient. The result is a probability statement about the moderation rather than a binary significance decision.
The intuition behind the method
In classical moderation analysis, the coefficient on the product term XW is tested against zero with a p-value. The Bayesian version keeps the same regression but describes beta_3 with a posterior distribution that combines the data with the prior. From that distribution one can read the probability that the moderation is positive, or the range of values that carries most of the posterior mass. The approach is most useful when the question concerns how large the moderation is, when the sample is modest, or when earlier work can be formalised as prior information.
History
The sources in this entry do not establish when or by whom Bayesian moderation analysis was first formulated as a named method, so no originator or date is given here. Hayes (2018) covers moderation as an interaction term in regression-based analysis, while Kruschke (2015) covers Bayesian estimation of regression models with MCMC software. Attributions of the framework to particular authors or decades are not supported by the cited sources and are omitted.
When to use it
Choose Bayesian moderation analysis when the question is whether a third variable changes the strength or direction of a predictor-outcome relationship, and the answer should express a degree of belief about the interaction rather than a yes/no decision. It is most useful when samples are small to moderate and a frequentist test of the interaction is underpowered, when earlier studies give a defensible basis for informative priors, or when the size of the interaction is the research question. Do not use it when the moderation hypothesis is purely exploratory and no defensible prior can be stated, because the prior then becomes an arbitrary input; a classical moderated regression with bootstrap intervals is more transparent in that case. The interaction term is only interpretable when both main effects are also in the model, so the model must be specified correctly before any Bayesian machinery is applied. The linear form described on this page suits continuous outcomes. For ordinal or categorical outcomes, or for binary and count outcomes, the likelihood must be replaced by one suited to that outcome (for example ordered logit, multinomial, logistic or Poisson). The interaction is then a change on the link scale and must be translated into outcome units before it is described substantively.
Limitations and considerations
- For non-identity link functions, beta_3 is a change on the link scale, such as log-odds, so its size must be translated back to the outcome scale before it can be described substantively.
- With small samples the posterior for beta_3 can be strongly shaped by the prior, so conclusions depend on the prior choice and require a sensitivity analysis.
- MCMC sampling is slower than ordinary least squares and needs convergence diagnostics, such as R-hat and effective sample size, before the posterior summaries can be interpreted.
- Credible intervals and posterior probabilities are less familiar to many reviewers than p-values and confidence intervals, so the reporting must state what the quantity means.
- The method does not correct for multiple testing when many moderators are screened; each interaction receives its own posterior, and examining many of them still raises the chance of finding an apparently strong moderation.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- The posterior for beta_3 supports direct statements such as the probability that the interaction is positive, which the model structure makes available for any coefficient on the product term.
- Conditional slopes at chosen values of W draw on the same posterior samples as beta_3, so the conditional effects and their intervals are internally consistent without a separate test for each level of W.
- A ROPE lets the analysis declare a moderation negligible, which a non-significant p-value cannot do: a non-significant interaction does not establish that beta_3 is zero.
- Informative priors on beta_3 can carry earlier evidence about the size of the interaction into the estimate, which is useful because interaction coefficients are often estimated with less precision than main effects.
- Changing the likelihood extends the same specification to logistic, Poisson or ordinal outcomes while keeping the interaction structure and its posterior summaries.
Applications
- Estimating how large a moderation effect is, when the question is the magnitude of change in a slope across levels of a continuous or grouped moderator rather than its mere existence.
- Confirmatory follow-up studies in which an earlier estimate of an interaction is available and the new study tests whether the moderation holds, using that estimate as an informative prior.
- Small-sample studies where a frequentist test of the interaction is underpowered and the posterior probability of the direction of moderation is the quantity reported.
- Analyses with logistic, count or ordinal outcomes in which the interaction is estimated on the link scale and conditional slopes are then reported on a substantively interpretable scale.
How it works
How it works
The outcome Y is modelled as a linear function of the predictor X, the moderator W, their product XW, and an error term. The coefficient beta_3 on XW is the interaction effect of primary interest: it gives the change in the slope of Y on X for a one-unit increase in W. Because beta_1 and beta_2 are conditional effects at zero of the other variable, the main effects must remain in the model even when the interaction is the focus. The linear form rests on four assumptions: the effects of X and W are linear on the scale of the outcome; observations are independent; the residuals follow the assumed error distribution (normal in the Gaussian case); and the residual variance is constant across fitted values (homoscedasticity). Severe multicollinearity among X, W and XW also makes the coefficients unstable, which is why centring is recommended. Before beta_3 is interpreted, the fitted model should be checked, for example with posterior predictive checks or residual plots, to see whether these assumptions hold for the data.
Formula
Y = \beta_0 + \beta_1 X + \beta_2 W + \beta_3 X W + \varepsilon
Priors are placed on beta_0, beta_1, beta_2 and beta_3. Weakly informative priors, such as normal distributions centred at zero with moderate spread, keep estimates within a plausible range without strongly constraining them. On standardised coefficients, a Normal(0, 1) prior is a common choice of this kind. Informative priors can encode an expected direction or magnitude taken from earlier studies. Because the prior is a substantive choice, it should be reported and its influence checked by refitting under alternative specifications.
Formula
p(\boldsymbol{\beta}) \propto \text{prior on } \beta_0, \beta_1, \beta_2, \beta_3Bayes' theorem combines the likelihood of the observed data with the priors to give the posterior distribution of the coefficients. For most realistic models this posterior has no closed form, so it is approximated by Markov chain Monte Carlo (MCMC) sampling in engines such as Stan or JAGS. Convergence should be checked before interpretation, for example with R-hat and effective sample size, because unmixed chains give misleading posterior summaries.
Formula
p(\boldsymbol{\beta} \mid \mathbf{y}) \propto p(\mathbf{y} \mid \boldsymbol{\beta})\, p(\boldsymbol{\beta})The main summary of the interaction is a 95% credible interval for beta_3, or its highest-density interval. Given the model and prior, beta_3 lies within this interval with posterior probability 0.95. An interval that excludes zero supports a moderation effect; one that straddles zero leaves the evidence ambiguous. A region of practical equivalence (ROPE) around zero can be used to judge the moderation negligible when the whole posterior lies inside it.
Formula
P(\beta_3 \in [L, U] \mid \mathbf{y}) = 0.95Because the size and direction of moderation are easier to read at specific levels of the moderator, conditional slopes of Y on X are computed at representative values of W, typically the mean and one standard deviation above and below it, or substantively meaningful cut-points. From the model above, the slope of Y on X at a value w of W is beta_1 + beta_3 * w, since the partial derivative of Y with respect to X is beta_1 + beta_3 W. Each conditional slope has its own posterior, drawn from the same posterior samples as beta_3, so its credible interval carries the full uncertainty. Plotting the conditional effects with these intervals shows the moderation pattern more directly than a table of coefficients.
Common pitfalls
- Treating a flat prior as prior-free: a flat prior on beta_3 is still a choice, and its implications for derived quantities such as conditional slopes or the probability of a sign can be far from uninformative.
- Reading a credible interval that includes zero as evidence of no moderation. It shows that the posterior still allows non-zero values; a ROPE comparison is needed before claiming a negligible effect.
- Leaving X and W uncentred before forming the product term, which produces strongly correlated terms and main-effect coefficients that refer to a value of the other variable that may lie outside the data.
- Reporting only beta_3 without conditional slopes or a plot, which leaves readers unable to see the direction of the moderation across the range of W.
- Not reporting the prior specification, so the analysis cannot be reproduced and its sensitivity to the prior cannot be judged.
Frequently asked questions
How does Bayesian moderation differ from standard moderated regression?
Both estimate the same linear model with an interaction term. The difference is inferential: standard moderated regression uses p-values and frequentist confidence intervals, while Bayesian moderation yields posterior distributions and credible intervals. The Bayesian approach allows direct probability statements about the interaction coefficient and incorporates prior information.
What prior should I use for the interaction coefficient?
A weakly informative prior — for example, Normal(0, 1) on standardised coefficients — is a safe default that regularises estimation without strongly constraining the result. If past studies report a specific range for the interaction, an informative prior can encode that knowledge. Always report the prior chosen and assess sensitivity by re-running with alternative prior widths.
Should I centre the predictor and moderator before the analysis?
Yes. Mean-centring X and W before forming the product term XW reduces multicollinearity and makes the main effect coefficients interpretable as effects at the mean of the other variable. This is standard practice in both frequentist and Bayesian moderation analysis.
How do I know whether the moderation is practically meaningful?
Beyond checking whether the credible interval for the interaction excludes zero, compute simple slopes at substantively meaningful values of W and examine their posterior distributions. You can also define a region of practical equivalence (ROPE) around zero and check whether the posterior for the interaction falls inside it, indicating a negligible effect.
Can I use Bayesian moderation with non-continuous outcomes?
Yes. The Bayesian framework generalises naturally to logistic, Poisson, ordinal, and other regression models; you simply specify the appropriate likelihood. Software such as brms in R makes it straightforward to fit Bayesian generalised linear models with interaction terms.
Related methods
Sources
Hayes, A. F. (2018). Introduction to Mediation, Moderation, and Conditional Process Analysis: A Regression-Based Approach (2nd ed.). Guilford Press.
ISBN: 978-1462534654Kruschke, J. K. (2015). Doing Bayesian Data Analysis: A Tutorial with R, JAGS, and Stan (2nd ed.). Academic Press.
ISBN: 978-0124058880