# How do you test for a "moderator" with ANOVA?

I am trying to understand the terminology, and the appropriate test.

What is the difference between a moderator, and just another factor, with ANOVA?

The first factor is a consumer's market confidence (very low, low, average, high, very high). The question is whether "a consumer's market confidence is moderated by gender" (male, female). The target is spending (continuous).

Does a post-hoc test tell you whether gender is a moderator? I know post-hocs will tell you which levels are significant.

I assume this is set up in R as

anova(spending ~ confidence + gender, data = SomeData)


What is the difference between gender being a moderator, as opposed to another factor?

An example coding in R would be informative here.

Thanks.

Before answering the question some background on moderation to quote from Wikipedia on this topic:

In statistics and regression analysis, moderation occurs when the relationship between two variables depends on a third variable. The third variable is referred to as the moderator variable or simply the moderator.[1] The effect of a moderating variable is characterized statistically as an interaction;[1] that is, a categorical (e.g., sex, ethnicity, class) or quantitative (e.g., level of reward) variable that affects the direction and/or strength of the relation between dependent and independent variables.

Further, in order to answer the question, I invoke the connection between ANOVA and regression analysis (see discussion here). This is also alluded to in the Wikipedia article which cites a regression model with an interaction term:

To quantify the effect of a moderating variable in multiple regression analyses, regressing random variable Y on X, an additional term is added to the model. This term is the interaction between X and the proposed moderating variable.[1] Thus, for a response Y and two variables x1 and moderating variable x2,:

$${ Y=b_{0}+b_{1}x_{1}+b_{2}x_{2}+b_{3}(x_{1}*x_{2})+ \epsilon}$$

Note: the interaction term is not a new independent variable! I view it as an augmenting concept to adjust for a deficiency (with respect to fitting the data) from the purely linear additive model specification. Further, the new interaction term is correlated to the main effects terms on which it is based, and as such, can introduce a multicollinearity issue in moderated regression.

To answer the question on how to test for the significance of the interaction term, the classic regression test (see material here) for a regression coefficient will suffice. Absent an interaction term different from zero, we do not have a moderated regression scenario, and related results on the other coefficients will suggest possible main effect variables.