[Rd] glm inconsistent behaviour (PR#5213)

finnknudsen at post.tele.dk finnknudsen at post.tele.dk
Thu Nov 20 16:31:36 MET 2003


Full_Name: Finn Knudsen
Version: 1.8.0
OS: windows 2000
Submission from: (NULL) (194.192.22.33)


The problem seems to happen when running the GLM. When both multiplicative
effects and an offset is present. I experienced this problem on my own dataset
when using af Poisson familiy with log link function but the behaviour can be
reproduced with the following code.

I do not know if it is a bug, but there are inconsistencies in the behaviour in
the GLM package when both an offset and multiplicative effects are present. In
this situation offset should be specified directly and not in the model. See
example below.

library(MASS)

data(anorexia)
 
## End Don't run

# These two will give exactly the same result in the summary
anorex.1 <- glm(Postwt ~ Prewt + Treat + offset(Prewt),
                 family = gaussian, data = anorexia)

anorex.1a <- glm(Postwt ~ Prewt + Treat , offset = Prewt,
                 family = gaussian, data = anorexia)

summary(anorex.1)
summary(anorex.1a)

# However the following two will not give the same results. 
# It would seem that the multiplicative effect is lost.

anorex.2 <- glm(Postwt ~ Prewt * Treat + offset(Prewt),
                 family = gaussian, data = anorexia)

anorex.2a <- glm(Postwt ~ Prewt * Treat , offset = Prewt,
                 family = gaussian, data = anorexia)


summary(anorex.2)
summary(anorex.2a)



More information about the R-devel mailing list