From Thomas Lumley <thomas@biostat.washington.edu>  Fri Oct 17 17:19:17 1997
From: Thomas Lumley <thomas@biostat.washington.edu> (Thomas Lumley)
Date: Fri, 17 Oct 1997 09:19:17 -0700 (PDT)
Subject: R-alpha: offset in glm not working
In-Reply-To: <3.0.1.32.19971017132850.00900530@pop3.mailst.ulg.ac.be>
Message-ID: <Pine.SUN.3.95.971017090921.10996B-100000@troi>

On Fri, 17 Oct 1997, Comblain muriel wrote:

> >
> >	With the new version of R (septembre), the function glm seems to ignore
> the offset. The ouput is exactly the same with or without the offset
> specification. I tried the same program in the version of april and it
> worked corectly. 
> >

Yes, this is a bug.  The modelling code was changing quite rapidly at
about the time rsept was built, and it ended up without support for
offsets.

There are two problems. The version of model.frame/model.matrix in
rsept doesn't allow 
	glm(y~x+offset(z))
and the model.offset() function is broken so that
	glm(y~x,offset=z) 
doesn't work. The second problem is easy to fix 

If you define
model.offset  <- function (x) 
{
        offsets <- attr(attr(x, "terms"), "offset")
        if (length(offsets) > 0) {
                ans <- 0
                for (i in offsets) ans <- ans + x[[i]]
        }
        else NULL
}

by adding it to your profile, or by editing the base library
then  glm(y~x,offset=z) will work. 


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: offset in glm not working
Thomas Lumley