Skip to content
Back to formatted view

Raw Message

Message-ID: <9a47fb08-20d2-b48e-4845-83c6613b1bf7@gmail.com>
Date: 2021-06-18T22:13:26Z
From: Ben Bolker
Subject: Question on glmmTMB
In-Reply-To: <CAEatWUoG24rGuWvVGTCv9-2e28ayXFCTG-WsHZsoKsV79Z3a0A@mail.gmail.com>

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:
> 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
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>