[R-sig-ME] Question on glmmTMB

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Sat Jun 19 00:13:26 CEST 2021


   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 using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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