[R] AIC consistency with S-PLUS

Alice Shelly alice at blarg.net
Fri Jun 1 06:10:56 CEST 2007


I apologize - i meant to include that i was talking about a simple set of 
nested linear models, fit using lm.
Yes, the extractAIC function in the MASS library does provide the same 
answer in both S-PLUS and in R. As does the AIC function in the nlme 
library! I suppose that is my answer, although i guess i am still wondering 
why my function in S-PLUS is not correct.

Thanks so much for your response.

----- Original Message ----- 
From: <Bill.Venables at csiro.au>
To: <alice at blarg.net>; <r-help at stat.math.ethz.ch>
Sent: Thursday, May 31, 2007 5:56 PM
Subject: RE: [R] AIC consistency with S-PLUS


I think we need some clarification here.

extractAIC() is available on both systems, in the stats package in R and
in the MASS library in S-PLUS.  If you use extractAIC() on both systems,
do you get the same ordering of models?

AIC() is also available on both systems, in the stats package again in
R, and in the nlme3 library in S-PLUS.  On R there are not too many
classes where methods are available for both, but on S-PLUS there are a
few.

So what are you comparing with what?  You need to say what classes of
objects you are dealing with, that is very important, and what generic
functions you are using for the comparison on each system.  The capacity
for confusion in this area is immense.

Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile:                (I don't have one!)
Home Phone:                     +61 7 3286 7700
mailto:Bill.Venables at csiro.au
http://www.cmis.csiro.au/bill.venables/

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Alice Shelly
Sent: Friday, 1 June 2007 10:07 AM
To: r-help at stat.math.ethz.ch
Subject: [R] AIC consistency with S-PLUS

Hello-
I understand that log-likelihoods are bound to differ by constants, but
if i estimate AIC for a set of simple nested linear models using the
following 4 methods, shouldn't at least two of them produce the same
ordering of models?

in R:
extractAIC
AIC

in S-PLUS:
AIC
n*log(deviance(mymodel)/n) + 2*p

I find it troubling that these methods all give me different answers as
to the best model or even short set of models.

Thanks for your comments.

Alice Shelly

[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list