# What is the difference between moderator/mediator variables and error terms/explanatory variables, respectively?

From what I've learned, and please correct me in any areas where I present erroneous information, moderator variables are essentially third variables and mediator variables are the variables that serve to explain the relation from the independent variable and dependent variable.

However, I'm having trouble understanding how the mediator and moderator variables are different from the variables found in a simple linear regression model.

For instance, We have a simple linear regression model:

The error term (ε) is the moderator variable, and the explanatory variable (x) would be the mediator variable, no?

What are the differences between error terms and moderator variables, and explanatory variables and mediator variables?

It does not make sense to talk about mediation and moderation when you have a single outcome and single predictor as in the case of simple linear regression. And the error term has nothing to do with moderation or mediation here. Lets look at the graphical presentations of mediation and moderation:

Above figure shows a moderation (also called interaction). The variable Group ($X_2$) moderates the effect of Influence ($X_1$) on Outcome ($Y$). We can write the formula (see wikipedia) for this model as

$$Y=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2+\varepsilon$$

$X_1X_2$ represents the interaction term.

The figure below illustrates mediation:

This time influence ($X_1$) has a direct effect on Outcome ($Y$), but also has an indirect effect through Mediator ($X_2$). In other words, $X_2$ mediates the effect of $X_1$ on $Y$. Again, we can find a (three-step) formula on related wikipedia page (I dropped first subscripts in the equations):

\begin{align} Y &= \beta_{0} + \beta_{1}X_1 + \varepsilon \tag{1} \\ \mbox{Me }(X_2) &= \beta_{0} + \beta_{1}X_1 + \varepsilon \tag{2}\\ Y &= \beta_{0} + \beta_{1}X_1 + \beta_{2}X_2 + \varepsilon \tag{3} \end{align}

First two steps are used to check whether the independent variable ($X_1$) is a significant predictor of dependent variable ($Y$) and mediator ($X_2$). And the last step (3) is an extension of the simple regression model: a multiple regression model with two predictors. If this is a true mediation relationship, we expect that $\beta_1$ will be smaller in (3) compared to $\beta_1$ in (1).

Of course these are simple examples, but I think they are clear enough to show what a mediator and moderator variable is, and that the independent variable ($X_1$) and the error term ($\varepsilon$) are not mediators or moderators. In fact, the error term ($\varepsilon$) has a substantial meaning in our models. It is the random component. As explained succinctly in this answer, "the error is any source of variation of $Y$ not included in the model, either from excluded variables or from measurement error, as long as they comply with the distributional assumptions." Because of the error term the relationship between variables is stochastic.

Keith, Timothy Z. 2015. Multiple Regression and Beyond: An Introduction to Multiple Regression and Structural Equation Modeling. London and New York: Routledge.

• See this Datacolada.org blog post for a useful discussion of moderators... datacolada.org/63 Oct 26, 2017 at 12:36