[R] factors in glm
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Fri Oct 22 11:57:14 CEST 1999
Jim Lindsey <jlindsey at alpha.luc.ac.be> writes:
> Is there any logical reason why glm prints out the labels of factor
> levels after variable names when baseline contrasts (contr.treatment)
> are used but the codes for the levels when mean contrasts (contr.sum)
> are used? Jim
Hmmm. We have in contr.sum
cont <- array(0, c(lenglev, lenglev - 1), list(levels,
NULL))
cont[col(cont) == row(cont)] <- 1
cont[lenglev, ] <- -1
I'd put list(level,levels[-lenglev]) there, but someone seems to have
decided that it wouldn't make sense? (I would also have coded the
value as rbind(diag(lenglev-1),-1), but that's another matter).
In the case of Helmert contrasts, one would by similar logic end up
with the same names as for contr.treatment, which would be confusing
(as if Helmert contrasts weren't confusing enough...!). Of course, you
currently cannot tell the difference between .sum and .helmert - you
only get a signal that something is "unusual".
What I'd really want is a way of labeling the summary() output with
the kind of contrast used. Ideally, in my mind, summary.(g)lm should
produce output like (for an age x sex interaction with age using
contr.sum and sex using contr.treat)
age(S).sex(T)
0-40.M
41-50.M
51-60.M
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list