wonky plot from check_model()
on a glmmTMB
example #654
Open
Description
This is from an nbinom1
model - the "overdispersion" and "normality of residuals" plots both look odd ...
library(glmmTMB)
library(dplyr) ## for mutate_at, %>%
#Build example data
x <- c("A", "B", "C", "D")
(time <- rep(x, each=20, times=3)) #time factor
y <- c("exposed", "ref1", "ref2")
(lake <- rep (y, each=80)) #lake factor
set.seed(123)
min <- runif(n=240, min=4.5, max=5.5) #mins used in model offset
set.seed(123)
(count <- rnbinom(n=240,mu=10,size=100)) #randomly generated negative binomial data
#make data frame
dat <- as.data.frame(cbind(time, lake, min, count))
dat <- dat %>%
mutate_at(c('min', 'count'), as.numeric)
#remove one combination of factors to make example rank deficient (all observations from time A and lake ref1)
dat2 <- filter(dat, time!="A" | lake !="ref1")
model <-glmmTMB(count~time*lake, family=nbinom1,
control = glmmTMBControl(rank_check = "adjust"),
offset=log(min), data=dat2)
library(performance)
check_model(model)