After running a different model using gamma() in the mgcv package, when I do

anova(model.ar1.int$lme, model.ar1.orderedfactor.int$lme)

I got the following:

Model df      AIC      BIC     logLik   Test  L.Ratio p-value

model.ar1.int\$lme      1 13 18828.83 18918.72  -9401.414                        

model.ar1.orderedfactor.int\$lme     2 14 22783.59 22880.39 -11377.795 1 vs 2 3952.761  <.0001

I don't understand how come the 2nd model's R-square adj is significantly lower and a lot higher AIC and BIC, and yet the p-value is still <.0001 significant — doesn't that mean the 2nd model is favored?


1 Answer 1


The anova test will conduct a likelihood ratio test on the two models. This involves comparing the log likelihood of two nested models and test whether the alternative model is better than the null model. The null model is the one with less parameters and the anova() command will detect which model this is. It doesn't matter if you type anova(m1, m2) or anova(m2, m1), the results will still be the same.

In your case, I'm wondering if your models really are nested. If they were nested, the models with more paramters (model.ar1.orderedfactor.int) shouldn't have a lower log likelihood than the other model. So are your models really nested? Is it possible to set some of the parameters in model.ar1.orderedfactor.int to 0 to get the first model? An example:

Imagine you have a dependent variable y and two independent variables x1 and x2. Now compare these models

modelA <- lm(y ~ x1)
modelB <- lm(y ~ x1 + x2)

ModelA is nested within modelB because if the estimated coefficient of x2 in modelB is set to 0, you will get model A. You can thus compare them with the anova test. Now consider this model:

modelC <- lm(y ~ x2)

ModelC is also nested within modelB and you can compare them with the anova test, but modelC and modelA are not nested within each other, since you cannot transform one into the other by setting an estimated coefficient to 0. You therefore cannot use the anova command to compare the models.

I suspect you have non-nested models which is the reason that the model with more parameters (degrees of freedom) has a much lower log likelihood.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.