The problem is that AIC is only defined for ML fitting, and gls defaults
to REML.
I have always maintained that it is a bug that nlme's logLik function
returns a log restricted likelihood for the default fits, and that this
is converted to a mis-named AIC. If you use
m1 <- gls(height ~ age, data = Loblolly, method="ML")
you wil get agreement.
On Tue, 11 Mar 2008, sbegueria wrote:
>
> Hello,
>
> I am comparing models made with nlme functions and non-nlme functions,
based
> on Akaike's AIC. The AIC values I get for exactly the same model
formulation
> --for example a linear model with no random effects fit with gls and lm,
> respectively-- do not fit, although the values of the four model parameters
> are exactly the same. For example:
>
> m1 <- gls(height ~ age, data = Loblolly)
> m2 <- lm(height ~ age, data = Loblolly)
>
> m1$coefficients
> (Intercept) age
> -1.312396 2.590523
> m2$coefficients
> (Intercept) age
> -1.312396 2.590523
>
> But then:
>
> AIC(m1)
> [1] 428.9243
> AIC(m2)
> [1] 423.9153
>
> I am trying to compare between more complex models, i.e. different ways of
> incorporating spatial self-correlation, and this issue with the AIC is
> really making me silly!
>
> Thanks,
>
> S. Begueria
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595