[R] strange logLik results in gls (nlme)
Wilhelm B. Kloke
wb at arb-phys.uni-dortmund.de
Fri Oct 31 13:18:32 CET 2003
I am trying to analyse a data with gls/lm using the following set of models
prcn.0.lm <- lm( log10(Y)~(cond-1)+(cond-1):t ,prcn)
prcn.1.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn,cor=corAR1())
prcn.0.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn)
prcn.1m.gls <- gls( log10(Y)~(cond-1)+(cond-1):t ,prcn,cor=corAR1(),method="ML")
I get the following AICs for these models:
> AIC(prcn.1m.gls)
[1] -78.3
> AIC(prcn.1.gls)
[1] -46.3
> AIC(prcn.0.gls)
[1] -24.7
> AIC(prcn.0.lm)
[1] -59.8
It is the difference between the last two, which puzzles me. They are
the same models. So I can't compare the AICs of prcn.0.lm and prcn.1.gls
directly. When using anova() for the comparison, I get a sensible result:
> anova(prcn.1.gls,prcn.0.lm)
Model df AIC BIC logLik Test L.Ratio p-value
prcn.1.gls 1 6 -46.3 -28.62 29.1
prcn.0.lm 2 5 -24.7 -9.97 17.3 1 vs 2 23.6 <.0001
Multiple arguments in AIC() give:
> AIC(prcn.1.gls,prcn.0.lm)
df AIC
prcn.1.gls 6 -46.3
prcn.0.lm 5 -59.8
How can I be sure to make it right?
More information about the R-help
mailing list