[R] summary(glm) for categorical variables

Eleni Rapsomaniki e.rapsomaniki at mail.cryst.bbk.ac.uk
Mon Sep 11 16:40:12 CEST 2006


Dear list people

Suppose we have a data.frame where variables are categorical and the response is
categorical eg:

my.df=NULL

for(i in LETTERS[1:3]){my.df[[i]]=sample(letters, size=10)}

my.df=data.frame(my.df)

my.df$class=factor(rep(c("pos", "neg"), times=5))

my.glm=glm(class ~ ., data=my.df, family=binomial)

summary(my.glm)

....
              Estimate Std. Error   z value Pr(>|z|)
(Intercept)  2.457e+01  1.310e+05  1.88e-04        1
Ad          -8.559e-11  1.853e+05 -4.62e-16        1
Aj          -9.897e-10  1.853e+05 -5.34e-15        1
An          -4.913e+01  1.853e+05 -2.65e-04        1
...

My question is is it possible to get the terms to appear as A,B, C instead of
every combination of Aa, Ab, Ac etc separately? 

Many Thanks in advance

Eleni Rapsomaniki
Birkbeck College, UK



More information about the R-help mailing list