First, I did not install R0.62.2 and there was no problem with binary
factor variables in 0.62.1. I discovered the problem since .3 appeared.

My Liege undergraduate social science students have a somewhat
different conception of contrasts than Brian's Oxford math students.
As it stands, the output of glm for binary factor variables is
unusable for them.

A hypothetical session of a student, with his or her thoughts
(translated from French) follows:

R : Copyright 1998, The R Development Core Team
Version 0.62.3  (August 28, 1998)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type	"?license" or "?licence" for distribution details.

R is a collaborative project with many contributors.
Type	"?contributors" for a list.

Type	"demo()" for some demos, "help()" for on-line help, or
	"help.start()" for a HTML browser interface to help.

> freq <- rpois(6,4)
> freq[6] <- freq[6]+20
> freq
[1]  1  3  4  3  4 28
> x <- gl(2,1,6)
> z <- gl(3,2,6)
> zz <- as.factor(c(rep(1,4),rep(2,2)))
> 
> options(contrasts = c("contr.treatment", "contr.poly"))
> summary(glm(freq~x*z,family=poisson))

Call:
glm(formula = freq ~ x * z, family = poisson)

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

Coefficients:
            Estimate   Std. Error z value  Pr(>|z|)
(Intercept)  4.676e-11  1.000e-00 4.68e-11 1.000   
x            1.099e+00  1.155e+00  0.951   0.341   
z2           1.386e+00  1.118e+00  1.240   0.215   
z3           1.386e+00  1.118e+00  1.240   0.215   
x.z2        -1.386e+00  1.384e+00 -1.001   0.317   
x.z3         8.473e-01  1.272e+00  0.666   0.505   

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 5.2596e+01  on 5  degrees of freedom
Residual deviance: 5.3291e-15  on 0  degrees of freedom
AIC: 31.691

Number of Fisher Scoring iterations: 3

> # x looks like a numeric variable but I do remember that it is factor
> # (even when I do the analysis from a .Rdata and reread the old output
> # 10 months later while studying for the exam ... )
> # hmm, what constraints did I use?
> # deduction: because the first category of z is missing, so must it be for x
> # -- perhaps baseline (what R calls treatment) constraints???
> 
> summary(glm(freq~x+z+x:zz,family=poisson))
Warning: NaNs produced in function "sqrt"

Call:
glm(formula = freq ~ x + z + x:zz, family = poisson)

Deviance Residuals: 
         1           2           3           4           5           6  
-6.639e-01   5.238e-01   4.409e-01  -4.352e-01         NaN   7.300e-08  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)  0.5978   0.5982     0.999  0.3176  
x            0.1823   0.6050     0.301  0.7631  
z2           0.5596   0.6260     0.894  0.3713  
z3           2.5520   0.6004     4.250  2.13e-05
x1.zz       -1.7636   0.8073    -2.185  0.0289  

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 52.5956  on 5  degrees of freedom
Residual deviance:  1.0988  on 1  degrees of freedom
AIC: 30.79

Number of Fisher Scoring iterations: 3

> # whoops, where did this new variable called x1 come from?
> # (binary factor variables don't have labels on them, do they? ... )
> # is it still the first category of x that is missing?
> # and was zz numeric or factor??
> 

The need to put the label on x in the interaction in the second glm
output clearly demonstrates that Brian is wrong. So put it on all the
time. The idea is maximum transparency, not maximum opaqueness.
Otherwise, let's also stop showing the levels when a factor variable
is printed out: S-Plus (apparently) does not do it, so it must be
useless to show them. ;-)

By the way, my suggestion sometime ago that contrasts should be
printed out is only half implemented: they appear with print.glm but
not with summary.glm.

As to the significance stars, I obviously immediately shut them off on
my site Rprofile, but that is on my portable. And they will be on our
teaching server as well. My concern is rather with the image of R: is
it to be modern, or 1950s statistics? Must I tell my students not to
download R from the Web because it will do weird things (inconsistent
labels on factor variables, strange stars appearing, ...) but only to
use the copy I give them? So let's set the default option to FALSE.

If anyone is interested in implementing profile likelihood intervals,
there are far simpler and faster numerical methods than Brian's
splines. Personally, I prefer plotting the whole profile curve. With
glm, this is quick and easy for the linear parameters (but not the
scale) using an offset. Most but not all of my library functions allow
it to be done simply as well. But such curves do not provide the
needed replacement printout instead of standard errors for non-normal
models ...

Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

