R-beta: Re: glm

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Fri Jul 10 19:30:02 CEST 1998

Jim Lindsey <jlindsey at luc.ac.be> writes:

>
> Peter, I am currently in Britain on my way to read a paper before the
> RSS next week, but completely forgot to tell you before I left that
> you correction for the Inf in glm is not sufficient. You have to
> eliminate the last else and change the second if else to an else
>  so that the Inf s are not set. Jim

?? (Perhaps what I said wasn't what I did?)

> summary(glm.D93)

Call:
glm(formula = counts ~ outcome * treatment, family = poisson)

Deviance Residuals:
[1]  0  0  0  0  0  0  0  0  0

Coefficients  [contrasts:  unordered=contr.treatment ordered=contr.poly ]:
Estimate Std. Error z value Pr(>|z|)
(Intercept)          2.89037  0.23570   12.263  <2e-16   ***
outcome2            -0.05716  0.33820   -0.169  0.866
outcome3            -0.18232  0.34960   -0.522  0.602
treatment2           0.10536  0.32489    0.324  0.746
treatment3           0.32850  0.30912    1.063  0.288
outcome2.treatment2 -0.63599  0.51417   -1.237  0.216
outcome3.treatment2  0.18232  0.47140    0.387  0.699
outcome2.treatment3 -0.59677  0.48093   -1.241  0.215
outcome3.treatment3 -0.55165  0.49553   -1.113  0.266
---
Signif. codes:  0  `***'  0.001  `**'  0.01  `*'  0.05  `.'  0.1  ` '  1

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 1.0581e+01  on 8  degrees of freedom
Residual deviance: 1.7532e-15  on 0  degrees of freedom
AIC: 59.632

Number of Fisher Scoring iterations: 1

Now what's wrong with that? ('cept that you don't like the stars...)

There's another problem, namely that setting dispersion to Inf in the
0 DF case doesn't seem to be too good an idea:

> summary(glm.D93)

Call:
glm(formula = counts ~ outcome * treatment, family = gaussian)

Deviance Residuals:
[1]  0  0  0  0  0  0  0  0  0

Coefficients  [contrasts:  unordered=contr.treatment ordered=contr.poly ]:
Estimate Std. Error z value Pr(>|z|)
(Intercept)          18      Inf        0       1
outcome2             -1      Inf        0       1
outcome3             -3      Inf        0       1
treatment2            2      Inf        0       1
treatment3            7      Inf        0       1
outcome2.treatment2  -9      Inf        0       1
outcome3.treatment2   3      Inf        0       1
outcome2.treatment3 -11      Inf        0       1
outcome3.treatment3 -10      Inf        0       1

(I.e. same thing with gaussian family). I think I'd rather have 0/NA/NA
in the last three columns. *And* those should be |t| not |z|, i.e.
est.disp should be true, also when there are no degrees of freedom.
Will fix for next release. Obviously, this is not nearly as important
as the known-dispersion cases because the display is useless whatever
you do.

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._