In statistics moderation occurs when the relationship between two variables depends on a third variable, in this case, the third variable is referred to as the moderating variable or simply the moderator. The effect of the moderating variable is often characterized statistically as an interaction, that is a third variable that affects the direction and or strength of the relation between your explanatory and response variable. So this type of exercise program affect the direction or strength of the relationship between diet and weight loss, the standard way of asking this question in the context of analysis of variance, is to move to the use of a two way or two factor analysis of variance, rather than the one-way or one-factor ANOVA that we've been using. Instead, we're going to take a less standard approach that can be consistently used across each of the inferential tools, that is ANOVA, Chi Square and Pearson correlation. In each of these contexts we're actually going to be asking the question, is our explanatory variable associated with our response variable for each population subgroup, or each level of our third variable? That is our diet type and weight loss associated for those doing the cardio exercise program, and our diet and weight loss associated for those using the weight training program. To accomplish this, we are going to run two separate ANOVA's, one for each level of a third variable, that is for each exercise program, syntax to be added to the program is listed here. We need to first create new data frames with only the sub sample of interest, that is either cardio or weights separately. When we run the analysis of variance, you'll see the following results, the ANOVA table, examining the relationship between diet and weight loss for those in the cardio exercise group, shows a large F value and a significant P value. When examining the means table, we see that for those involved in the cardio exercise program, diet A is associated with greater weight loss 20.5 pounds on average then diet B, 7.1 pounds on average. The association between diet and weight loss for those involved in the weight training exercise program is also significant, it has a large F value and a significant P value. However, the mean show that the association is in the opposite direction, for those involved in weight training, diet B is associated with greater weight loss 11.5 pounds compared to diet A only 8.8 pounds, here these results are shown graphically, as you can see, the relationship between diet and weight loss depends on which exercise program is being used. When using cardio diet A is significantly better for weight loss than diet B, when using weights diet B is significantly better for weight loss than diet A. Thus we can say there is a significant statistical interaction between the variables diet and weight loss and the type of exercise, our third variable moderates the association between diet and weight loss. >> Suppose that we did not evaluate exercise as a possible moderator and instead focused only on the association between diet and weight loss for the entire population. Based on this graph, obviously we would have incorrectly concluded that diet A is better than diet B, as we now know, that is only true if we're looking at the cardio group.