Moderation and mediation are terms for measuring conditional effects. They are frequently discussed in the context of SEMs. However, both can be estimated in standard regression settings.

# Moderation

## Definition

Let $$X$$ be a predictor, $$Y$$ be a response and we are studying whether $$Z$$ moderates the relationship between $$X$$ and $$Y$$. In other words, we want to know whether $$Z$$ modifies the strength (or direction) of the relationship between $$X$$ and $$Y$$. For example, we could study the relationship between socio-economic status ($$X$$) and frequency of breast exams ($$Y$$). Among younger women, breast exams are rare because current recommendations are for women age 40 and over to get exams. However, in older women, there is a relationship because those with higher SES tend to be more concerned with health. Age ($$Z$$) moderates the relationship between SES and frequency of breast exams.

## In Regression

Moderation is represented in a regression model with nothing more than an interaction term. There is a causal aspect to it, in that there needs to be the assumption that the predictor ($$X$$) has a causal relationship on the response ($$Y$$). If $$X$$ is randomized, this assumption is satisfied. If the $$X$$ is not randomized, this assumption must be based on theory and domain specific knowledge.

Fit the interaction model,

$Y = \beta_0 + \beta_1X + \beta_2Z + \beta_3XZ + \epsilon.$

Therefore, $$\beta_3$$ measures the moderation effect.

# Mediation

## Definition

Again, let $$X$$ be a predictor and $$Y$$ be a response. We are studying whether $$Z$$ mediates the relationship between $$X$$ and $$Y$$. Mediating variables are more complicated that moderators. A variable ($$Z$$) is said to be a mediator if it partially or fully explains the relationship between the predictor ($$X$$) and the response ($$Y$$). The easiest way to explain this is visually.

The unmediated and mediated model follow.