Skip to content

Question on glmmTMB

3 messages · Ebhodaghe Faith, Ben Bolker

#
Dear All,

The glmmTMB package is used to model data with mixed effects. For example:

glmmTMB(count~spp + mined + (1|site), Salamanders, family=nbinom2)

But I'm just curious to know what happens when the package is used to model
data without random effects (will this still be fine? How does this compare
with just using the glm function in the MASS package?). See example below:

glmmTMB(count~spp + mined, Salamanders, family=nbinom2)

With kind regards,
Faith
#
This should be fine. Unlike many mixed model packages, glmmTMB can 
handle models with no random effect.  When in doubt, you can just try 
out a comparison - this obviously isn't a 100% guarantee that something 
works reliably, but in this example all three approaches give very 
similar answers:

library(glmmTMB)
library(bbmle)
m1 <- glmmTMB(count~spp + mined, Salamanders, family=nbinom2)
m2 <- MASS::glm.nb(count~spp + mined, Salamanders)
m3 <- mle2(count ~ dnbinom(mu = exp(logmu), size = exp(logk)),
            parameters = list(logmu ~ spp + mined),
            start = list(logmu = 0, logk = 0),
            data = Salamanders)

library(broom)
library(broom.mixed)
tidy(m1)
tidy(m2)
tidy(m3)
On 6/18/21 4:10 AM, Ebhodaghe Faith wrote:
#
Thank you, Ben Bolker.

I find your response very helpful.

Regards,
Faith
On Sat, 19 Jun 2021, 1:13 a.m. Ben Bolker, <bbolker at gmail.com> wrote: