From ripley at stats.ox.ac.uk  Thu Jun 16 08:06:49 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 16 Jun 2005 07:06:49 +0100 (BST)
Subject: [Rd] a bug in glm.fit() (PR#7947)
In-Reply-To: <20050616034227.77C02A1F9@slim.kubism.ku.dk>
References: <20050616034227.77C02A1F9@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.61.0506160703510.21725@gannet.stats>

What is the bug?

This is the same model: the `intercept' term affects the null model, not 
the actual model.  Just look at all the output.

On Thu, 16 Jun 2005 jyzz88 at gmail.com wrote:

> 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
>>  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

-- 
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



[Rd] a bug in glm.fit() (PR#7947)
Prof Brian Ripley