I was always under the impression that regression is just a more general form of ANOVA and that the results would be identical. Recently, however, I have run both a regression and an ANOVA on the same data and the results differ significantly. That is, in the regression model both main effects and the interaction are significant, while in the ANOVA one main effect is not significant. I expect this has something to do with the interaction, but it's not clear to me what is different about these two ways of modeling the same question. If it's important, one predictor is categorical and the other is continuous, as indicated in the simulation below. Any help would be appreciated. Thanks!
Here is an example of what my data looks like and what analyses I'm running, but without the same p-values or effects being significant in the results (my actual results are outlined above):
group<-c(1,1,1,0,0,0) moderator<-c(1,2,3,4,5,6) score<-c(6,3,8,5,7,4) summary(lm(score~group*moderator)) summary(aov(score~group*moderator))