0

I have been playing around with the generalized mixed models and I fit two models to the salamander data using glmer.nb and glmmTMB as shown below.

    library(glmmTMB)
    library(merTools)

    ## remove the outlier count
    dat <- Salamanders[which(Salamanders$count<20), ]

    fm1 <- glmmTMB(count ~ cover + (1|spp), 
                   data=dat, family=nbinom2(link="log"))
    fm2 <- glmer.nb(count ~ cover + (1|spp), data=dat)
    summary(fm1); summary(fm2)

Summary output for glmmTMB:

    Conditional model:
                Estimate Std. Error z value Pr(>|z|)    
    (Intercept)  0.01037    0.24547   0.042    0.966    
    cover        0.41932    0.08350   5.022 5.12e-07 ***

Summary output for glmer.nb:

    Fixed effects:
                  Estimate Std. Error z value Pr(>|z|)    
    (Intercept) -0.0007037  0.2453352  -0.003    0.998    
    cover        0.4180324  0.0831942   5.025 5.04e-07 ***

The model output for the intercepts are different, why is this? Is this a case like here where the two models are finding different local optima? If so how can I graphically represent this like in Ben Bolker's answer in the linked question?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467

0 Answers0