>> To accomplish this,
we are going to run two separate ANOVAS, 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 subsample of interest.
That is either cardio or weights separately.
When we run the analysis of variants, 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, than 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 means 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's 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.