I am trying to test the interaction term of level1 * question
. I have two ways, using anova(lm)
and anova(lm, lm2)
. Why their results are so different?
Code
pacman::p_load(nlme)
data_long = read.csv("https://raw.githubusercontent.com/slfan2013/Jen-Falbe---menu-labeling---Dec-2020/main/STATA/data_long.csv?token=ADGNCRVI2JVHC72URESWLFS765ALK")[,-1]
lm = lme(pme ~ level1 * question, random = ~1 | subject, data = data_long)
lm2 = lme(pme ~ level1 + question, random = ~1 | subject, data = data_long)
Results
> anova(lm)
numDF denDF F-value p-value
(Intercept) 1 2648 21598.329 <.0001
level1 2 1324 8.981 0.0001
question 2 2648 17.354 <.0001
level1:question 4 2648 0.857 0.4888
> anova(lm, lm2)
Model df AIC BIC logLik Test L.Ratio p-value
lm 1 11 11853.99 11923.15 -5915.995
lm2 2 7 11838.61 11882.62 -5912.303 1 vs 2 7.383951 0.1169
I don't understand why the interaction p-value from the first method is 0.4888 and the second is 0.1169, which is too different.