[R] [FORGED] SE for all fixed factor effect in GLMM

Rolf Turner r@turner @ending from @uckl@nd@@c@nz
Sun Dec 30 06:11:55 CET 2018


On 12/30/18 5:31 PM, Marc Girondot via R-help wrote:

> Dear members,
> 
> Let do a example of simple GLMM with x and G as fixed factors and R as 
> random factor:
> 
> (note that question is the same with GLM or even LM):
> 
> x <- rnorm(100)
> y <- rnorm(100)
> G <- as.factor(sample(c("A", "B", "C", "D"), 100, replace = TRUE))
> R <- as.factor(rep(1:25, 4))
> 
> library(lme4)
> 
> m <- lmer(y ~ x + G + (1 | R))
> summary(m)$coefficients
> 
> I get the fixed effect fit and their SE
> 
>  > summary(m)$coefficients
>                 Estimate Std. Error    t value
> (Intercept)  0.07264454  0.1952380  0.3720820
> x           -0.02519892  0.1238621 -0.2034433
> GB           0.10969225  0.3118371  0.3517614
> GC          -0.09771555  0.2705523 -0.3611706
> GD          -0.12944760  0.2740012 -0.4724344
> 
> The estimate for GA is not shown as it is fixed to 0. Normal, it is the 
> reference level.
> 
> But is there a way to get SE for GA of is-it non-sense question because 
> GA is fixed to 0 ?

In a way, yes it's a nonsense question, as you say.

If you really want an SE for GA then re-parametrise so that GA is 
meaningful:

m2 <- lmer(y ~ x + 0 + G + (1 | R))

Note that with this formulation GA will be there, "(Intercept)" will 
disappear, and GB, GC and GD will now mean something different.

GA from m2 = (Intercept) from m
GB from m2 = (Intercept) + GB from m
GC from m2 = (Intercept) + GC from m
GD from m2 = (Intercept) + GD from m

I haven't followed what you've done below, but I think that you are 
making things unnecessarily complicated and life difficult for yourself.

cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
> 
> ______________
> 
> I propose here a solution but I don't know if it is correct. It is based 
> on reordering levels and averaging se for all reordering:
> 
> G <- relevel(G, "A")
> m <- lmer(y ~ x + G + (1 | R))
> sA <- summary(m)$coefficients
> 
> G <- relevel(G, "B")
> m <- lmer(y ~ x + G + (1 | R))
> sB <- summary(m)$coefficients
> 
> G <- relevel(G, "C")
> m <- lmer(y ~ x + G + (1 | R))
> sC <- summary(m)$coefficients
> 
> G <- relevel(G, "D")
> m <- lmer(y ~ x + G + (1 | R))
> sD <- summary(m)$coefficients
> 
> seA <- mean(sB["GA", "Std. Error"], sC["GA", "Std. Error"], sD["GA", 
> "Std. Error"])
> seB <- mean(sA["GB", "Std. Error"], sC["GB", "Std. Error"], sD["GB", 
> "Std. Error"])
> seC <- mean(sA["GC", "Std. Error"], sB["GC", "Std. Error"], sD["GC", 
> "Std. Error"])
> seD <- mean(sA["GD", "Std. Error"], sB["GD", "Std. Error"], sC["GD", 
> "Std. Error"])
> 
> seA; seB; seC; seD
> 
> 
> Thanks,
> 
> Marc



More information about the R-help mailing list