[R-sig-ME] A GLMER Question

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Wed Dec 15 00:48:58 CET 2021



On 12/13/21 4:36 PM, Jamie Dallas wrote:
> Hello All,
> I am running a GLMER with Gamma distribution and identity link. I have to
> add a small constant (1 or 0.001) to my outcome to be able to run my models.
> 
> I know in a linear regression with Normality assumption, this only effects
> my intercept but my other coefficient estimates will stay the same.
> 
> However, in my GLMER models I am noticing the choice of constant effects
> all my parameter estimates. I thought since I am using an identity link
> this should not happen.
> 
> 1- Is my understanding wrong?
> 
> 2- Why are my parameter estimates changing in my Gamma distributed GLMER
> with identity link models, depending on the choice of added constant to my
> outcome?
> 
> Thank you in advance!
> 
> Best,
> 
> Jamie

   I don't necessarily see why you should expect the slopes to be 
invariant; GLMs don't have the same properties as LMs, even with an 
identity link. "Small" will be context-dependent.  If this makes much of 
a difference to your results, or if you have more than a few zero 
values, you might need to think about a more principled approach such as 
a hurdle model ...

Example:

library(lme4)
dd <- data.frame(x = runif(100),
                  f = factor(rep(1:10, 10)))
set.seed(101)
dd$y <- simulate(~ x + (1|f),
                  family = Gamma(link = "identity"),
                  newdata = dd,
                  newparams = list(beta = rep(1,2),
                                   theta = 1,
                                   sigma = 1))[[1]]
dd$y[sample(nrow(dd), size = 10)] <- 0

fitf <- function(off) {
     g1 <- glmer(y + off ~ x + (1|f),
                 family = Gamma(link = "identity"),
                 data = dd)
     return(fixef(g1))
}

try(fitf(0))
offvec <- 10^c((-5):(-2))
cbind(offvec, t(sapply(offvec, fitf)))


      offvec (Intercept)           x
[1,]  1e-05    1.408488 -0.08994451
[2,]  1e-04    1.408578 -0.08994445
[3,]  1e-03    1.409508 -0.09000147
[4,]  1e-02    1.085238  0.45049626
 >

try(fitf(0))
offvec <- 10^c((-5):(-2))
cbind(offvec, t(sapply(offvec, fitf)))



More information about the R-sig-mixed-models mailing list