in need of some clarity (or charity, whichever way you look at it) - haha!
Running a linear mixed regression with two within subject variables each of which has two levels (AB, XY), with the DV as the DV (this was randomly generated), there are 10 participants in this randomly generated dataset. Data structure looks like this:
Subject AB XY DV
1 1 1 0.8434005
1 1 2 0.6905524
1 2 1 1.8233546
1 2 2 1.4140288
Using Lmertest, I firstly ran the following for the main effects model with subjects as a random variable:
> anova(lmer(DV~AB+XY+(1|Subject), data=df))
Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
AB 0.03248 0.03248 1 28 0.0322 0.8589
XY 0.49017 0.49017 1 28 0.4861 0.4914
Then ran the model with the interaction:
> anova(lmer(DV~AB*XY+(1|Subject), data=df))
Type III Analysis of Variance Table with Satterthwaite's method
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
AB 3.6828 3.6828 1 27 4.0786 0.05346 .
XY 2.6918 2.6918 1 27 2.9811 0.09567 .
AB:XY 3.8526 3.8526 1 27 4.2666 0.04859 *
---
As you can see the Main effects have changed wildly across their values.
When I run a similar analysis in SPSS, there is no such change to the values of the main effects. Have I done something wrong? Why would adding an interaction change the main effect? And why does no such change happen in SPSS? Please advise or signpost me to some resources as I am having no luck. I do know that getting R and SPSS to produce the same output has its difficulties, but this seems like a very fundamental issue - either the interaction term changes the main effects or it does not.
Is this something to do with the type of anova being conducting? type I would do AB and then XY and then AB*XY, but type III does something more complex where it does them all together? Would that indicate that SPSS (as adding the interaction does not change the values for the main effect) is not doing a type III anova?
Thanks in advance for any help at all!