[R] AIC models are not all fitted to the same number of observation

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Wed Mar 21 10:56:05 CET 2012


Hi,

Using lme from the package nlme  3.1-103, I meet a strange warning. I am 
trying to compare to models with:

library(nlme)
lmez6=lme(lepus~vulpes,random=~1|troncon/an,data=ika_z6_test)
lmez60=lme(lepus~1,random=~1|troncon/an,data=ika_z6_test)

Both have the same number of observations and groups:

lmez6
Linear mixed-effects model fit by REML
   Data: ika_z6_test
   Log-restricted-likelihood: -2267.756
   Fixed: lepus ~ vulpes
(Intercept)      vulpes
  1.35017117  0.04722338

Random effects:
  Formula: ~1 | troncon
         (Intercept)
StdDev:   0.8080261

  Formula: ~1 | an %in% troncon
         (Intercept)  Residual
StdDev:    1.086611 0.4440076

Number of Observations: 1350
Number of Groups:
         troncon an %in% troncon
             169            1350


 > lmez60
Linear mixed-effects model fit by REML
   Data: ika_z6_test
   Log-restricted-likelihood: -2266.869
   Fixed: lepus ~ 1
(Intercept)
    1.435569

Random effects:
  Formula: ~1 | troncon
         (Intercept)
StdDev:   0.8139646

  Formula: ~1 | an %in% troncon
         (Intercept)  Residual
StdDev:    1.086843 0.4445815

Number of Observations: 1350
Number of Groups:
         troncon an %in% troncon
             169            1350

...but when I want to compare their AIC, I get:

AIC(lmez6,lmez60)
        df      AIC
lmez6   5 4545.511
lmez60  4 4541.737
Warning message:
In AIC.default(lmez6, lmez60) :
   models are not all fitted to the same number of observations


Has anybody an explanation about this strange warning ? To what extent 
this warning may limit the conclusions that could be drawn from AIC 
comparison ?

Thanks in advance,

Patrick



More information about the R-help mailing list