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)
glm inconsistent behaviour (PR#5213)
2 messages · finnknudsen@post.tele.dk, Brian Ripley
Please try R-patched aka 1.8.1 beta, as I think this has already been fixed (PR#4941). Certainly I can see no difference there.
On Thu, 20 Nov 2003 finnknudsen@post.tele.dk wrote:
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)
Not needed, BTW
## 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)
______________________________________________ R-devel@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley@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