Moderation Analysis
Look beyond a single average relationship to see how that relationship changes, and for whom.
Does working remotely for longer make it easier to focus on work? The experience of someone with a dedicated space where they can work quietly at home may differ from that of someone who has to work in the living room or at the kitchen table. The effect of remote work on work focus may not be the same for everyone.
Moderation analysis is a way to find out whether the relationship between one variable and an outcome changes depending on the level of another variable. Rather than checking only a single average relationship, moderation analysis looks at the situations in which that relationship gets stronger or weaker, and sometimes even changes direction.
In this article we use remote work days, having a dedicated workspace, and work focus as an example to cover what an interaction term means and how it is calculated, simple slopes analysis, reading the graph, centering, the difference between moderation and mediation, and how to report the results.
All numbers and results are examples for illustration.
What is a moderation effect?
A moderation effect is when the relationship between a predictor X and an outcome Y changes depending on a moderator M.
For example, if the relationship between remote work days (X) and focus (Y) changes depending on whether a person has a dedicated workspace (M), then having a workspace is a moderator.
A moderator does not have to be a categorical variable that divides people into groups. Continuous variables such as age, level of job stress, or years of experience can also serve as moderators. What matters is not just whether the moderator is related to the average level of the outcome, but whether it changes the relationship between X and Y itself.
In ordinary regression, simply entering X and M together as predictors does not let you test a moderation effect. You must include an interaction term created by multiplying the two variables.
Example: remote work and work focus
Suppose a research team surveyed 420 office workers and recorded their average number of remote work days per week over the past month, their work focus, and whether they have a dedicated workspace at home.
Focus is a 0–100 scale made by summing several items; a higher score means it was easier to focus on work.
| Variable | Role | Measurement |
|---|---|---|
| Work focus (Y) | Outcome | 0–100 points |
| Remote work days per week (X) | Predictor | 0–5 days |
| Dedicated workspace (M) | Moderator | No = 0, Yes = 1 |
| Work experience, job type | Candidate control variables | Continuous, categorical |
The research question is: “Does the relationship between remote work days and work focus depend on whether a person has a dedicated workspace?”
Because this study uses observational data, the results cannot be interpreted directly as a causal effect of remote work.
How do you write a moderation regression model?
A basic linear regression model with a continuous X and a binary moderator M also includes the interaction term.
Yi = β0 + β1Xi + β2Mi + β3(XiMi) + εi
Here β1 is the slope of remote work days when M = 0, and β2 is the difference in predicted focus between the two groups when X = 0. Most importantly, β3 shows how much the slope of X differs between the M = 1 group and the M = 0 group.
You can add control variables such as work experience or job type, but whether the necessary confounders can be controlled depends on the study design. Also, in a model that includes an interaction term, the main-effect coefficients must be interpreted at a specific reference value of the other variable.
Calculating the moderation effect from the regression coefficients
Suppose the estimated regression equation is Ŷ = 60 − 1.5X + 3M + 3.0(XM).
| Term | Coefficient | Meaning |
|---|---|---|
| Intercept | 60.0 | Predicted focus with no workspace and 0 remote work days |
| Remote work days (X) | -1.5 | Slope per additional remote work day when there is no workspace |
| Dedicated workspace (M) | 3.0 | Predicted difference for the group with a workspace at 0 remote work days |
| X × M | 3.0 | Difference in the remote work slope depending on having a workspace |
With no workspace (M = 0), the interaction term drops out, giving Ŷ = 60 − 1.5X. Each additional remote work day is associated with focus that is 1.5 points lower on average.
With a workspace (M = 1), the equation becomes Ŷ = 63 + 1.5X. In this group, each additional remote work day is associated with focus that is 1.5 points higher on average. The difference between the two slopes is 1.5 − (−1.5) = 3.0 points.
Comparing predicted values in a table makes it easier to see
Using the regression equation above to predict focus for each number of remote work days gives the following.
These values are not individuals’ actual observed scores but predicted group means from the regression model.
| Remote work days per week | No workspace | Has workspace | Group difference (has − no) |
|---|---|---|---|
| 0 days | 60.0 | 63.0 | +3.0 |
| 1 day | 58.5 | 64.5 | +6.0 |
| 2 days | 57.0 | 66.0 | +9.0 |
| 3 days | 55.5 | 67.5 | +12.0 |
| 4 days | 54.0 | 69.0 | +15.0 |
| 5 days | 52.5 | 70.5 | +18.0 |
At 0 remote work days, the predicted difference between having and not having a workspace is 3 points, but at 4 days it grows to 15 points. This dependence of the group difference on the level of X is the hallmark of an interaction. It should be kept distinct from the simple fact that workers with a workspace have a higher average score.
How is a moderation effect tested statistically?
Testing a moderation effect usually means checking whether the interaction term β3 is 0.
For example, suppose you obtained the following regression results.
| Variable | B | Standard error | 95% confidence interval | p-value |
|---|---|---|---|---|
| Remote work days | -1.50 | 0.45 | [-2.38, -0.62] | .001 |
| Dedicated workspace | 3.00 | 1.60 | [-0.14, 6.14] | .061 |
| Remote work × workspace | 3.00 | 0.92 | [1.20, 4.80] | .001 |
The interaction coefficient is 3.00, and its 95% confidence interval does not include 0. So we can interpret this as statistical evidence that the remote work–focus slopes differ between the two groups. The interaction effect can be significant even when the main effect of workspace is not, and the two answer different questions.
These numbers are results constructed for illustration. In a real analysis, also report the control variables in the model, how standard errors were calculated, how missing data were handled, the sample size, and so on.
How do you read an interaction plot?
A moderation effect is easier to understand when you draw and compare a regression line for each group.
Put remote work days per week on the horizontal axis and predicted focus on the vertical axis, and draw two lines, one for each workspace group.
In this example, the line for the group without a workspace goes down to the right, and the line for the group with one goes up. The fact that the two lines are not parallel shows the different slopes visually. What matters is not only the height difference between the lines but the difference in their slopes.
A graph alone, however, cannot establish statistical significance or causation. Check the confidence intervals and the distribution of the observations as well, and avoid stretching the lines into ranges of remote work days where there isn’t enough real data.
What is simple slopes analysis?
If the interaction term turns out to be significant, you can check specifically how much the relationship between X and Y differs under particular conditions.
This is called simple slopes analysis. In this example, which uses a binary moderator, you just calculate the slope at M = 0 and at M = 1.
To calculate the confidence interval of each slope, you need to account not only for the relevant regression coefficients but also for the covariance between them. So you should not conclude from the p-value of the interaction term alone that both groups’ individual slopes are significant.
If the moderator is continuous, you can calculate simple slopes at the mean, at the mean ±1 standard deviation, or at theoretically meaningful values. Mean ±1 standard deviation, though, is just a conventional way to present them and is not necessarily the most appropriate choice.
How do you interpret a continuous moderator?
Suppose that instead of having a dedicated workspace, we use the level of distraction at home (0–10 points) as the moderator.
The model can still be written the same way, Y = β0 + β1X + β2M + β3XM + ε. But now the slope of remote work days is not a single value per group; it changes continuously with the value of the moderator M.
Conditional slope of X = β1 + β3M
For example, if β1 = 2.0 and β3 = −0.4, the slope is 1.2 points when the distraction level is 2 and −0.8 points when it is 7. In other words, when there is little distraction at home, remote work days can show a positive relationship with focus, but when distraction is heavy they can show a negative one.
This example is a separate illustrative model, unrelated to the binary-moderator results above. With a continuous moderator, it is especially useful to visualize the conditional effect and its confidence interval across the whole range of interest.
Why use mean centering?
Continuous variables are often mean-centered before the interaction term is created.
Mean centering subtracts the variable’s mean from each observation.
Xc = X − X̄
For example, if the average number of remote work days per week is 2.5, the centered value for someone who worked remotely 4 days is 1.5. In the centered regression equation, the main effect of workspace represents the group difference at the average of 2.5 remote work days, not at 0 days.
This helps make the main effects and the intercept easier to interpret in practical terms. But in a linear model with the same variables and interaction, mean centering alone does not fundamentally change the interaction coefficient, the overall predicted values, the model fit, or its test results.
Mean centering also does not solve every multicollinearity problem. Keep ease of interpretation and numerical stability apart as separate issues.
How do moderation and mediation differ?
Moderation and mediation both look more closely at relationships between variables, but they ask different questions.
| Aspect | Moderation | Mediation |
|---|---|---|
| Key question | When, for whom, and under what conditions does the relationship change? | Through what pathway does the relationship arise? |
| Key variable | Moderator M | Mediator M |
| Main analysis | Interaction term X×M | Indirect path X→M→Y |
| Main results | Conditional slopes, interaction coefficient | Direct effect, indirect effect |
In the remote work example, if the relationship between remote work days and focus differs depending on having a workspace, that is moderation. If instead you examine a process in which remote work reduces commuting stress and the reduced stress is linked to focus, that is mediation.
The two analyses can be used together depending on the research goal, but finding a moderation effect does not by itself explain why the relationship changes.
Points to watch in moderation analysis
Don’t judge moderation without an interaction term.
Even if the predictor and the moderator are each significant, that does not mean the relationship between them changes with conditions. Moderation must be confirmed with the interaction term and conditional effects.
Check that each group has enough data.
If most of the group with a dedicated workspace work remotely 4–5 days and most of the group without one work remotely 0–1 days, there may not be enough common range to compare the two groups’ slopes directly. It is important to check the observed range and whether predictions are extrapolated.
Check the model assumptions and standard errors.
Check linearity, heteroscedasticity of residuals, highly influential observations, and so on, and use heteroscedasticity-robust standard errors if needed. Also keep in mind that focus scores are bounded between 0 and 100 when examining predicted values and residuals.
Distinguish statistical significance from practical importance.
Even if the interaction term is significant, you need to judge separately whether the difference is large enough to matter for improving actual work environments. It is good practice to report the units of the coefficients along with their confidence intervals.
Don’t assert causation.
Workers who have a workspace may also differ in job type, housing, job level, and so on. Rather than concluding from a moderated regression on observational data alone that “a dedicated workspace increases the effect of remote work,” it is more accurate to say that the relationship between the two variables was observed to differ depending on having a workspace.
How do you report the results?
When reporting a moderation effect, it is good to give the definitions of X, Y, and M, how the moderator was coded, the regression coefficient and confidence interval of the interaction term, and the conditional slopes and predicted values.
If possible, providing predicted lines for each group makes the results easy for readers to understand.
Sample report
To examine whether the relationship between remote work days and work focus depends on having a dedicated workspace, a linear regression including an interaction term was conducted with 420 office workers. In the group without a workspace, the slope of remote work days was estimated at -1.50, and the interaction term representing the difference in slopes by workspace status was statistically significant (B = 3.00, SE = 0.92, 95% CI [1.20, 4.80], p = .001).
According to the model, the slope of remote work days in the group with a workspace was 1.50. This suggests that the relationship between remote work days and focus ran in opposite directions depending on whether workers had a dedicated workspace. However, because observational data were used, this difference cannot be concluded to be a causal moderating effect of having a workspace.
An actual report should also include descriptive statistics, the uncertainty of each conditional slope, control variables, and model diagnostics.
Moderation explains the conditions of a relationship
Moderation analysis evaluates whether the relationship between a predictor and an outcome changes depending on the level of another variable.
With a regression model that includes an interaction term, you can estimate differences in slopes across groups or conditions and interpret those differences concretely using simple slopes and predicted values.
In the remote work example, the group without a workspace showed lower focus with more remote work days, and the group with a workspace showed the opposite direction. Results like these reveal differences across conditions that you could miss by looking at a single average relationship.
The key to moderation analysis is going beyond whether a variable is related to an outcome to explain how that relationship changes, and under what conditions.