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

Bert Gunter bgunter.4567 at gmail.com
Fri Feb 16 03:28:54 CET 2018


This is really a statistical issue. What do you think the Intercept term
represents? See ?contrasts.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Thu, Feb 15, 2018 at 5:27 PM, Marc Girondot via R-help <
r-help at r-project.org> wrote:

> 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
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list