In the 'nlme' R package, for instance, I ran the following models:
model1 <- lme(y~x, random=~x|group, data=data) model2 <- lme(y~x, random=~1|group, data=data)
And then I compared them with an ANOVA:
anova(model1, model2) Model df AIC BIC logLik Test L.Ratio p-value model1 1 6 -310.3753 -289.7468 161.1876 model2 2 4 -307.4426 -293.6903 157.7213 1 vs 2 6.932679 0.0312
I am confused about how to interpret that output. Correct me if I am wrong, but in model1 I allow my intercept and slope to be random, as opposed to model2, where only my intercept has a random effect. Model1 AIC is better than model2, but model2 BIC is better than model1. However, the anova table tells me that the models are different from each other. With that in mind, I wonder which one is the best model and how could I justify that?