Re: [R] AIC in glm.fit with intercept

From: Luke <jyzz88_at_gmail.com>
Date: Thu 16 Jun 2005 - 13:35:53 EST

More interesting:
lm() works fine to get AIC. I wonder if there is a bug in glm.fit().

> AIC(lm(myY~0+myX, data=data.frame(myY,myX)))
[1] 38.94657
> AIC(lm(myY~1+myX, data=data.frame(myY,myX)))
[1] -650.9808

-Luke

On 6/15/05, Luke <jyzz88@gmail.com> wrote:
> Dear R users,
>
> glm.fit() gave me the same AIC's regardless of TRUE or FALSE intercept option.
>
> > myX <- as.matrix(1:10)
> > myY <- 3+5*myX
> > foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=TRUE)
> > foo$aic
> [1] 38.94657
> > foo <- glm.fit(x=myX, y=myY, family = gaussian(link = "identity"), intercept=FALSE)
> > foo$aic
> [1] 38.94657
>
> Is my code wrong or is it a bug in glm.fit?
>
> -Luke
>



R-help@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 Received on Thu Jun 16 13:43:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:43 EST