[R] glm

Thomas Lumley thomas at biostat.washington.edu
Mon Jan 31 18:01:32 CET 2000

On Mon, 31 Jan 2000, Keith Worsley wrote:

>        I've downloaded R for windows (9.0.1) and it is great! I've
> converted all my lecture notes for my GLM course to run on R (they are
> available on my web page below). I must admit I particularly like the
> default contrast options, which are identical to GLIM. Also I like the
> gl function - very useful! I have a couple of questions/bugs:
> 1. predict.glm doesn't work, but predict.lm does - actually all I am
> after is the equivalent of the GLIM

More precisely, predict.glm(,se.fit=T) doesn't work.

On line 36, change from

>      $extract %vl
> command, which I want to get from
>      vl<-predict.glm(glm,se.fit=T)$se.fit^2
> A bit clumsy - is there a better way? I'm using it to calculate
> 'deleted' residuals:
>      resid(glm)/(1-vl/summary(glm)$dispersion)

I think rstudent() does what you want.

> 2. What are you actually using as an estimator of the dispersion
> parameter? Is it dev/df, or is it sum((Y-mu)^2/V(mu))/df?

It's the latter.  Look at summary.glm for the code

> 3. It would be very nice to be able to fix the dispersion parameter in
> advance, before using summary(glm). You might know that the data is
> exponential, in which case you want to fix the gamma dispersion
> parameter to 1, or you might have a previous value from another
> analysis, or you might want to cope with extra-binomial/poisson
> variation by using dev/df. Is there an easy way of doing this? In GLIM,
> you just say $cal %sc= ...

summary.glm() has a dispersion= option.


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

r-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list