[R] SE for all levels (including reference) of a factor atfer a GLM

Marc Girondot marc_grt at yahoo.fr
Fri Feb 16 02:27:13 CET 2018


Dear R-er,

I try to get the standard error of fitted parameters for factors with a 
glm, even the reference one:

a <- runif(100)
b <- sample(x=c("0", "1", "2"), size=100, replace = TRUE)
df <- data.frame(A=a, B=b, stringsAsFactors = FALSE)

g <- glm(a ~ b, data=df)
summary(g)$coefficients

# I don't get SE for the reference factor, here 0:

               Estimate Std. Error    t value     Pr(>|t|)
(Intercept)  0.50384827 0.05616631  8.9706490 2.236684e-14
b1          -0.03598386 0.07496151 -0.4800311 6.322860e-01
b2           0.03208039 0.07063113  0.4541962 6.507023e-01

# Then I try to change the order of factors, for example:

df$B[df$B=="0"] <- "3"
g <- glm(a ~ b, data=df)
summary(g)$coefficients

By I get the same...

Any idea ?

Thanks

Marc



More information about the R-help mailing list