[R] Fitting a model with an offset in bigglm

Ben Bolker bbolker at gmail.com
Tue Feb 8 21:24:01 CET 2011


Dennis Murphy <djmuser <at> gmail.com> writes:

> 
> Hi:
> 
> Did you try putting the offset in the model formula, as in
> 
> bigglm( y ~ offset(z) + x, ...)      ?
> 
> I haven't tried bigglm() personally (BTW, it's in the biglm package, which
> wasn't mentioned), but this syntax works in the standard glm() function, so
> perhaps it maps to bigglm() as well... (?)
> 
> HTH,
> Dennis

 A quick test suggests that bigglm does *not* respect offset
parameters in the formula, and a quick check in bigglm.function suggests
likewise:

...
   tt <- terms(formula)
    beta <- start
    etafun <- function(x) if (is.null(beta)) 
        rep(0, nrow(x))
    else x %*% beta

...
farther down, etafun is called with the results of 
model.matrix().  It should be fairly 'straightforward'
(ha!) to incorporate an offset term in this, but it might
be better to ask the package maintainer to do it rather
than to have random people like me doing the hacking ...

  Ben Bolker



More information about the R-help mailing list